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

Method NewSinkTube

fs/contube/memory.go:117–140  ·  view source on GitHub ↗
(ctx context.Context, configMap ConfigMap)

Source from the content-addressed store, hash-verified

115}
116
117func (f *MemoryQueueFactory) NewSinkTube(ctx context.Context, configMap ConfigMap) (chan<- Record, error) {
118 config := SinkQueueConfig{}
119 if err := configMap.ToConfigStruct(&config); err != nil {
120 return nil, err
121 }
122 c := f.getOrCreateChan(config.Topic)
123 wrapperC := make(chan Record)
124 go func() {
125 defer f.release(config.Topic)
126 for {
127 select {
128 case <-ctx.Done():
129 return
130 case event, ok := <-wrapperC:
131 if !ok {
132 return
133 }
134 event.Commit()
135 c <- event
136 }
137 }
138 }()
139 return wrapperC, nil
140}

Callers

nothing calls this directly

Calls 4

getOrCreateChanMethod · 0.95
releaseMethod · 0.95
ToConfigStructMethod · 0.80
CommitMethod · 0.65

Tested by

no test coverage detected