MCPcopy
hub / github.com/lni/dragonboat / completed

Method completed

engine.go:509–543  ·  view source on GitHub ↗
(workerID uint64)

Source from the content-addressed store, hash-verified

507}
508
509func (p *workerPool) completed(workerID uint64) {
510 count := 0
511 n, ok := p.busy[workerID]
512 if !ok {
513 plog.Panicf("worker %d is not busy", workerID)
514 }
515 if _, ok := p.saving[n.clusterID]; ok {
516 plog.Debugf("%s completed saveRequested", n.id())
517 delete(p.saving, n.clusterID)
518 count++
519 }
520 if _, ok := p.recovering[n.clusterID]; ok {
521 plog.Debugf("%s completed recoverRequested", n.id())
522 delete(p.recovering, n.clusterID)
523 count++
524 }
525 if sc, ok := p.streaming[n.clusterID]; ok {
526 plog.Debugf("%s completed streamRequested", n.id())
527 if sc == 0 {
528 plog.Panicf("node completed streaming when not streaming")
529 } else if sc == 1 {
530 delete(p.streaming, n.clusterID)
531 } else {
532 p.streaming[n.clusterID] = sc - 1
533 }
534 count++
535 }
536 if count == 0 {
537 plog.Panicf("not sure what got completed")
538 }
539 if count > 1 {
540 plog.Panicf("completed more than one type of snapshot op")
541 }
542 p.setIdle(workerID)
543}
544
545func (p *workerPool) inProgress(clusterID uint64) bool {
546 _, ok1 := p.saving[clusterID]

Callers 1

workerPoolMainMethod · 0.95

Calls 4

setIdleMethod · 0.95
PanicfMethod · 0.65
DebugfMethod · 0.65
idMethod · 0.45

Tested by

no test coverage detected