Files
mini_lsm/mini-lsm-starter/src/table/builder.rs

38 lines
1.0 KiB
Rust
Raw Normal View History

#![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 std::path::Path;
use anyhow::Result;
use super::{BlockMeta, SsTable};
/// Builds an SSTable from key-value pairs.
pub struct SsTableBuilder {
pub(super) meta: Vec<BlockMeta>,
// Add other fields you need.
}
impl SsTableBuilder {
/// Create a builder based on target SST size and target block size.
pub fn new(block_size: usize) -> Self {
unimplemented!()
}
/// Adds a key-value pair to SSTable
pub fn add(&mut self, key: &[u8], value: &[u8]) {
unimplemented!()
}
/// 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!()
}
}