Mercurial > lbo > hg > sstable
changeset 5:b2891489832c
Add some details to README
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 19 Nov 2016 14:06:36 +0100 |
parents | c0e7fd030c24 |
children | df70324cb053 |
files | README.md src/table_reader.rs |
diffstat | 2 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sat Nov 19 14:03:28 2016 +0100 +++ b/README.md Sat Nov 19 14:06:36 2016 +0100 @@ -7,9 +7,11 @@ The general process is -* Writing a table to disk, using `TableBuilder`. The entries have to be added in - sorted order. -* Reading a table from disk, using `TableReader`. +* Writing a table, using `TableBuilder`. The entries have to be added in + sorted order. The data doesn't have to be written to disk; any type + implementing `Write` works. +* Reading a table, using `TableReader`. Again, the source is generic; any type + implementing `Read + Seek` can be used. Note that the tables and some other structures are generic over the ordering of keys; usually you can just use `StandardComparator`, though. @@ -20,3 +22,5 @@ If there's data corruption in the files on disk, defective blocks will be skipped. How many entries a single block contains depends on the block size, which can be set in the `Options` struct. + +Contributions are very welcome!
--- a/src/table_reader.rs Sat Nov 19 14:03:28 2016 +0100 +++ b/src/table_reader.rs Sat Nov 19 14:06:36 2016 +0100 @@ -101,8 +101,7 @@ } } -/// This iterator is a "TwoLevelIterator"; it uses an index block in order to get an offset hint -/// into the data blocks. +/// Iterator over a Table. pub struct TableIterator<'a, R: 'a + Read + Seek, C: 'a + Comparator> { table: &'a mut Table<R, C>, current_block: BlockIter<C>, @@ -114,7 +113,8 @@ impl<'a, C: Comparator, R: Read + Seek> TableIterator<'a, R, C> { /// Skips to the entry referenced by the next entry in the index block. /// This is called once a block has run out of entries. - /// Returns Ok(false) if the end has been reached, returns Err(...) if it should be retried. + /// Returns Ok(false) if the end has been reached, returns Err(...) if it should be retried + /// (e.g., because there's a corrupted block) fn skip_to_next_entry(&mut self) -> Result<bool> { if let Some((_key, val)) = self.index_block.next() { let r = self.load_block(&val);