feat(code): part 3 iterators

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2022-12-24 10:11:06 -05:00
parent b263ea4fac
commit 4eb2177a3e
39 changed files with 1304 additions and 73 deletions

View File

@@ -1,9 +1,10 @@
#![allow(unused_variables)] // TODO(you): remove this lint after implementing this mod
#![allow(dead_code)] // TODO(you): remove this lint after implementing this mod
use anyhow::Result;
use std::path::Path;
use anyhow::Result;
use super::{BlockMeta, SsTable};
/// Builds an SSTable from key-value pairs.
@@ -14,17 +15,22 @@ pub struct SsTableBuilder {
impl SsTableBuilder {
/// Create a builder based on target SST size and target block size.
pub fn new(target_size: usize, block_size: usize) -> Self {
pub fn new(block_size: usize) -> Self {
unimplemented!()
}
/// Adds a key-value pair to SSTable, return false when SST full.
#[must_use]
pub fn add(&mut self, key: &[u8], value: &[u8]) -> bool {
/// Adds a key-value pair to SSTable
pub fn add(&mut self, key: &[u8], value: &[u8]) {
unimplemented!()
}
/// Builds the SSTable and writes it to the given path. No need to actually write to disk until chapter 4 block cache.
/// Get the estimated size of the SSTable.
pub fn estimated_size(&self) -> usize {
unimplemented!()
}
/// Builds the SSTable and writes it to the given path. No need to actually write to disk until
/// chapter 4 block cache.
pub fn build(self, path: impl AsRef<Path>) -> Result<SsTable> {
unimplemented!()
}