NewKeyIterator is just like NewIterator, but allows the user to iterate over all versions of a single key. Internally, it sets the Prefix option in provided opt, and uses that prefix to additionally run bloom filter lookups before picking tables from the LSM tree.
(key []byte, opt IteratorOptions)
| 490 | // single key. Internally, it sets the Prefix option in provided opt, and uses that prefix to |
| 491 | // additionally run bloom filter lookups before picking tables from the LSM tree. |
| 492 | func (txn *Txn) NewKeyIterator(key []byte, opt IteratorOptions) *Iterator { |
| 493 | if len(opt.Prefix) > 0 { |
| 494 | panic("opt.Prefix should be nil for NewKeyIterator.") |
| 495 | } |
| 496 | opt.Prefix = key // This key must be without the timestamp. |
| 497 | opt.prefixIsKey = true |
| 498 | opt.AllVersions = true |
| 499 | return txn.NewIterator(opt) |
| 500 | } |
| 501 | |
| 502 | func (it *Iterator) newItem() *Item { |
| 503 | item := it.waste.pop() |