MCPcopy Index your code
hub / github.com/FunctionStream/function-stream / getOrCreateChan

Method getOrCreateChan

fs/contube/memory.go:44–62  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

42}
43
44func (f *MemoryQueueFactory) getOrCreateChan(name string) chan Record {
45 f.mu.Lock()
46 defer f.mu.Unlock()
47 defer func() {
48 slog.InfoContext(f.ctx, "Get memory queue chan",
49 "current_use_count", atomic.LoadInt32(&f.queues[name].refCnt),
50 "name", name)
51 }()
52 if q, ok := f.queues[name]; ok {
53 atomic.AddInt32(&q.refCnt, 1)
54 return q.c
55 }
56 c := make(chan Record, 100)
57 f.queues[name] = &queue{
58 c: c,
59 refCnt: 1,
60 }
61 return c
62}
63
64func (f *MemoryQueueFactory) release(name string) {
65 f.mu.Lock()

Callers 2

NewSourceTubeMethod · 0.95
NewSinkTubeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected