docs: update solution & starter code documentation for day 2 (#20)
* feat(docs): update day 2 starter code documentation * feat(docs): update day 2 solution code documentation
This commit is contained in:
@@ -21,12 +21,14 @@ impl SsTableBuilder {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Adds a key-value pair to SSTable
|
||||
/// Adds a key-value pair to SSTable.
|
||||
/// Note: You should split a new block when the current block is full.(`std::mem::replace` may be of help here)
|
||||
pub fn add(&mut self, key: &[u8], value: &[u8]) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Get the estimated size of the SSTable.
|
||||
/// Since the data blocks contain much more data than meta blocks, just return the size of data blocks here.
|
||||
pub fn estimated_size(&self) -> usize {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ use crate::iterators::StorageIterator;
|
||||
pub struct SsTableIterator {}
|
||||
|
||||
impl SsTableIterator {
|
||||
/// Create a new iterator and seek to the first key-value pair.
|
||||
/// Create a new iterator and seek to the first key-value pair in the first data block.
|
||||
pub fn create_and_seek_to_first(table: Arc<SsTable>) -> Result<Self> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Seek to the first key-value pair.
|
||||
/// Seek to the first key-value pair in the first data block.
|
||||
pub fn seek_to_first(&mut self) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
@@ -28,24 +28,30 @@ impl SsTableIterator {
|
||||
}
|
||||
|
||||
/// Seek to the first key-value pair which >= `key`.
|
||||
/// Note: You probably want to review the handout for detailed explanation when implementing this function.
|
||||
pub fn seek_to_key(&mut self, key: &[u8]) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
impl StorageIterator for SsTableIterator {
|
||||
fn value(&self) -> &[u8] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Return the `key` that's held by the underlying block iterator.
|
||||
fn key(&self) -> &[u8] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Return the `value` that's held by the underlying block iterator.
|
||||
fn value(&self) -> &[u8] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Return whether the current block iterator is valid or not.
|
||||
fn is_valid(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Move to the next `key` in the block.
|
||||
/// Note: You may want to check if the current block iterator is valid after the move.
|
||||
fn next(&mut self) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user