finish 2.2 write-up

Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
This commit is contained in:
Alex Chi Z
2024-01-23 14:43:44 +08:00
parent 274a2cb7a2
commit 016c6ccadc
9 changed files with 195 additions and 7 deletions

View File

@@ -28,6 +28,9 @@ impl SimpleLeveledCompactionController {
Self { options }
}
/// Generates a compaction task.
///
/// Returns `None` if no compaction needs to be scheduled. The order of SSTs in the compaction task id vector matters.
pub fn generate_compaction_task(
&self,
_snapshot: &LsmStorageState,
@@ -35,6 +38,13 @@ impl SimpleLeveledCompactionController {
unimplemented!()
}
/// Apply the compaction result.
///
/// The compactor will call this function with the compaction task and the list of SST ids generated. This function applies the
/// result and generates a new LSM state. The functions should only change `l0_sstables` and `levels` without changing memtables
/// and `sstables` hash map. Though there should only be one thread running compaction jobs, you should think about the case
/// where an L0 SST gets flushed while the compactor generates new SSTs, and with that in mind, you should do some sanity checks
/// in your implementation.
pub fn apply_compaction_result(
&self,
_snapshot: &LsmStorageState,