diff --git a/Cargo.toml b/Cargo.toml index fe521da..7d50ded 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kip_db" -version = "0.1.2-alpha.18" +version = "0.1.2-alpha.19" edition = "2021" authors = ["Kould "] description = "轻量级、异步 基于LSM Leveled Compaction K-V数据库" diff --git a/examples/mvcc.rs b/examples/mvcc.rs index 57431e7..3411e34 100644 --- a/examples/mvcc.rs +++ b/examples/mvcc.rs @@ -12,7 +12,7 @@ async fn main() -> Result<(), KernelError> { let kip_storage = KipStorage::open_with_config(config).await?; println!("New Transaction"); - let mut tx = kip_storage.new_transaction(CheckType::None).await; + let mut tx = kip_storage.new_transaction(CheckType::Optimistic).await; println!("Set KeyValue after the transaction -> (key_1, value_1)"); kip_storage diff --git a/examples/scan_read.rs b/examples/scan_read.rs index df48cb5..0b3f5e6 100644 --- a/examples/scan_read.rs +++ b/examples/scan_read.rs @@ -36,7 +36,7 @@ async fn main() -> Result<(), KernelError> { .await?; println!("New Transaction"); - let tx = kip_storage.new_transaction(CheckType::None).await; + let tx = kip_storage.new_transaction(CheckType::Optimistic).await; println!("Iter without key_3 By Transaction:"); let mut iter = tx.iter(Bound::Unbounded, Bound::Excluded(b"key_3"))?; diff --git a/src/kernel/lsm/mvcc.rs b/src/kernel/lsm/mvcc.rs index fd7f2db..d9c9457 100644 --- a/src/kernel/lsm/mvcc.rs +++ b/src/kernel/lsm/mvcc.rs @@ -30,7 +30,6 @@ unsafe impl Sync for BufPtr {} struct BufPtr(NonNull>); pub enum CheckType { - None, Optimistic, } @@ -89,7 +88,6 @@ impl Transaction { let batch_data = buf.into_iter().collect_vec(); match self.check_type { - CheckType::None => (), CheckType::Optimistic => { if self .mem_table() @@ -350,7 +348,7 @@ mod tests { kv_store.set(kv.0.clone(), kv.1.clone()).await?; } - let mut tx_1 = kv_store.new_transaction(CheckType::None).await; + let mut tx_1 = kv_store.new_transaction(CheckType::Optimistic).await; for kv in vec_kv.iter().take(times).skip(100) { tx_1.set(kv.0.clone(), kv.1.clone()); @@ -402,7 +400,7 @@ mod tests { let config = Config::new(temp_dir.into_path()).major_threshold_with_sst_size(4); let kv_store = KipStorage::open_with_config(config).await?; - let mut tx_1 = kv_store.new_transaction(CheckType::None).await; + let mut tx_1 = kv_store.new_transaction(CheckType::Optimistic).await; let mut tx_2 = kv_store.new_transaction(CheckType::Optimistic).await; tx_1.set(Bytes::from("same_key"), Bytes::new());