Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Commit

Permalink
code fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Dec 1, 2023
1 parent 4cf9071 commit 7decf44
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kip_db"
version = "0.1.2-alpha.18"
version = "0.1.2-alpha.19"
edition = "2021"
authors = ["Kould <[email protected]>"]
description = "轻量级、异步 基于LSM Leveled Compaction K-V数据库"
Expand Down
2 changes: 1 addition & 1 deletion examples/mvcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/scan_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))?;
Expand Down
6 changes: 2 additions & 4 deletions src/kernel/lsm/mvcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ unsafe impl Sync for BufPtr {}
struct BufPtr(NonNull<Vec<KeyValue>>);

pub enum CheckType {
None,
Optimistic,
}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 7decf44

Please sign in to comment.