make mvcc impl compile with new key module

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2024-01-25 12:27:16 +08:00
committed by Alex Chi Z
parent 753e6d4f9e
commit 971d0b1c81
11 changed files with 96 additions and 62 deletions

View File

@@ -2,6 +2,8 @@ use std::fmt::Debug;
use bytes::Bytes;
pub const TS_ENABLED: bool = false;
pub struct Key<T: AsRef<[u8]>>(T);
pub type KeySlice<'a> = Key<&'a [u8]>;

View File

@@ -1,7 +1,7 @@
use tempfile::tempdir;
use crate::{
key::KeySlice,
key::{KeySlice, TS_ENABLED},
table::{bloom::Bloom, FileObject, SsTable, SsTableBuilder},
};
@@ -75,9 +75,17 @@ fn test_task3_block_key_compression() {
let dir = tempdir().unwrap();
let path = dir.path().join("1.sst");
let sst = builder.build_for_test(path).unwrap();
assert!(
sst.block_meta.len() <= 25,
"you have {} blocks, expect 25",
sst.block_meta.len()
);
if TS_ENABLED {
assert!(
sst.block_meta.len() <= 34,
"you have {} blocks, expect 34",
sst.block_meta.len()
);
} else {
assert!(
sst.block_meta.len() <= 25,
"you have {} blocks, expect 25",
sst.block_meta.len()
);
}
}