feat(#21): SstableIterator — lazy block loading + cobertura >90%#71
Merged
Conversation
- Add SstableIterator in src/storage/sst_iterator.rs
- Implements StorageIterator trait (key/value/is_valid/next/seek)
- Loads blocks lazily from disk/cache via Arc<SstableReader>
- next() transparently crosses block boundaries
- seek() uses sparse-index binary search + in-block linear scan
- SstableIterator::new() and new_seek() constructors
- read_entry / read_key private helpers with bounds checking
- 25 unit + integration tests (single block, multi-block,
seek edge-cases, tombstones, large SSTables)
- src/storage/reader.rs: expose read_block as pub(crate)
so SstableIterator can load blocks via the reader
- src/storage/mod.rs: register pub mod sst_iterator
Closes #21
…ble iterator tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexto
Implementa a Task 2.2 — SSTable Iterator (closes #21).
O que foi feito
src/storage/sst_iterator.rs— arquivo novoSstableIteratorimplementaStorageIteratorsobre umArc<SstableReader>:new(reader)new_seek(reader, key)keynext()seek(key)is_valid()trueenquanto aponta para um entry válidoBlocos são carregados de forma lazy (da cache ou do disco via
read_block) sem duplicar a lógica de decompressão.src/storage/reader.rsread_blockpromovido defn→pub(crate) fnpara queSstableIteratorpossa reutilizá-lo.src/storage/mod.rsAdicionado
pub mod sst_iterator.Testes (27 novos)
newposiciona no primeiro entry;new_seekposiciona corretamenteblock_sizepequeno)LogRecordseek()next()além do fim é no-op,is_valid()permanecefalseread_entryeread_key— happy path e dados truncadosfind_block_for_keynunca retorna índice fora-de-bounds