(ctx context.Context, configMap ConfigMap)
| 115 | } |
| 116 | |
| 117 | func (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 | } |
nothing calls this directly
no test coverage detected