appendIterators appends iterators to an array of iterators, for merging. Note: This obtains references for the table handlers. Remember to close these iterators.
(iters []y.Iterator, opt *IteratorOptions)
| 289 | // appendIterators appends iterators to an array of iterators, for merging. |
| 290 | // Note: This obtains references for the table handlers. Remember to close these iterators. |
| 291 | func (s *levelHandler) appendIterators(iters []y.Iterator, opt *IteratorOptions) []y.Iterator { |
| 292 | s.RLock() |
| 293 | defer s.RUnlock() |
| 294 | |
| 295 | if s.level == 0 { |
| 296 | // Remember to add in reverse order! |
| 297 | // The newer table at the end of s.tables should be added first as it takes precedence. |
| 298 | // Level 0 tables are not in key sorted order, so we need to consider them one by one. |
| 299 | var out []*table.Table |
| 300 | for _, t := range s.tables { |
| 301 | if opt.pickTable(t) { |
| 302 | out = append(out, t) |
| 303 | } |
| 304 | } |
| 305 | return appendIteratorsReversed(iters, out, opt.Reverse) |
| 306 | } |
| 307 | |
| 308 | tables := opt.pickTables(s.tables) |
| 309 | if len(tables) == 0 { |
| 310 | return iters |
| 311 | } |
| 312 | return append(iters, table.NewConcatIterator(tables, opt.Reverse)) |
| 313 | } |
| 314 | |
| 315 | type levelHandlerRLocked struct{} |
| 316 |
nothing calls this directly
no test coverage detected