MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / startDistributor

Method startDistributor

watch_manager.go:217–244  ·  view source on GitHub ↗

startDistributor starts both the collector and distributor goroutines

()

Source from the content-addressed store, hash-verified

215
216// startDistributor starts both the collector and distributor goroutines
217func (wm *watchManager) startDistributor() {
218 defer wm.cleanUpSubscribers()
219
220 // start the victim collector goroutine
221 // it collects the victim buckets from the victim channel
222 // and handle delete bucket operation
223 wm.wg.Add(1)
224 go func() {
225 defer wm.wg.Done()
226 wm.runVictimCollector()
227 }()
228
229 // Start the distributor goroutine (consumes from distributeChan)
230 wm.wg.Add(1)
231 go func() {
232 defer wm.wg.Done()
233 wm.runDistributor()
234 }()
235
236 // start the collector goroutine (collects messages into batches)
237 wm.wg.Add(1)
238 go func() {
239 defer wm.wg.Done()
240 wm.runCollector()
241 }()
242
243 wm.wg.Wait()
244}
245
246// runCollector collects messages from watchChan and batches them
247func (wm *watchManager) runCollector() {

Callers 2

StartMethod · 0.95

Calls 7

cleanUpSubscribersMethod · 0.95
runVictimCollectorMethod · 0.95
runDistributorMethod · 0.95
runCollectorMethod · 0.95
WaitMethod · 0.80
AddMethod · 0.45
DoneMethod · 0.45

Tested by 1