Returns a buffered iterator which could be used in a for range loop. 相当于所有的值都缓存在channel中
()
| 198 | // Returns a buffered iterator which could be used in a for range loop. |
| 199 | // 相当于所有的值都缓存在channel中 |
| 200 | func (m ConcurrentHashMap) IterBuffered() <-chan Tuple { |
| 201 | chans := snapshot(m) |
| 202 | total := 0 |
| 203 | for _, c := range chans { |
| 204 | total += cap(c) |
| 205 | } |
| 206 | ch := make(chan Tuple, total) |
| 207 | go fanIn(chans, ch) |
| 208 | return ch |
| 209 | } |
| 210 | |
| 211 | // Returns a array of channels that contains elements in each shard, |
| 212 | // which likely takes a snapshot of `m`. |
no test coverage detected