sendEvent writes an event to all currently registered events. The consumer channels are each read by a goroutine that filters the event and sends it to the caller of the Watch method.
(e clientv3.Event)
| 153 | // channels are each read by a goroutine that filters the event and sends it to |
| 154 | // the caller of the Watch method. |
| 155 | func (m *mockKV) sendEvent(e clientv3.Event) { |
| 156 | m.eventsMtx.Lock() |
| 157 | for ch := range m.events { |
| 158 | // non-blocking send |
| 159 | select { |
| 160 | case ch <- e: |
| 161 | default: |
| 162 | } |
| 163 | } |
| 164 | m.eventsMtx.Unlock() |
| 165 | } |
| 166 | |
| 167 | // RequestProgress implements the Clientv3Facade interface |
| 168 | func (m *mockKV) RequestProgress(context.Context) error { |