MCPcopy Create free account
hub / github.com/eapache/channels / SharedBuffer

Struct SharedBuffer

shared_buffer.go:36–42  ·  view source on GitHub ↗

SharedBuffer implements the Buffer interface, and permits multiple SimpleChannel instances to "share" a single buffer. Each channel spawned by NewChannel has its own internal queue (so values flowing through do not get mixed up with other channels) but the total number of elements buffered by all sp

Source from the content-addressed store, hash-verified

34//parallelism with goroutines, limiting the total number of elements in the pipeline without limiting the number of elements
35//at any particular step.
36type SharedBuffer struct {
37 cases []reflect.SelectCase // 2n+1 of these; [0] is for control, [1,3,5...] for recv, [2,4,6...] for send
38 chans []*sharedBufferChannel // n of these
39 count int
40 size BufferCap
41 in chan *sharedBufferChannel
42}
43
44func NewSharedBuffer(size BufferCap) *SharedBuffer {
45 if size < 0 && size != Infinity {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected