MCPcopy
hub / github.com/aceld/zinx / fanIn

Function fanIn

zutils/shard_lock_map.go:355–368  ·  view source on GitHub ↗

fanIn reads elements from channels `chanList` into channel `out`

(chanList []chan Tuple, out chan Tuple)

Source from the content-addressed store, hash-verified

353
354// fanIn reads elements from channels `chanList` into channel `out`
355func fanIn(chanList []chan Tuple, out chan Tuple) {
356 wg := sync.WaitGroup{}
357 wg.Add(len(chanList))
358 for _, ch := range chanList {
359 go func(ch chan Tuple) {
360 for t := range ch {
361 out <- t
362 }
363 wg.Done()
364 }(ch)
365 }
366 wg.Wait()
367 close(out)
368}
369
370// IterBuffered returns a buffered iterator which could be used in a for range loop.
371func (slm ShardLockMaps) IterBuffered() <-chan Tuple {

Callers 1

IterBufferedMethod · 0.85

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected