Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
5d56686
add spanich check
laohanlinux Nov 10, 2022
028b1c2
:cat::dog:
laohanlinux Nov 12, 2022
7c32710
add log
Nov 16, 2022
f090cbe
:dog:
laohanlinux Nov 16, 2022
3dd5431
fix compiled
laohanlinux Dec 27, 2022
95a8954
:dog:
laohanlinux Dec 28, 2022
6f7b92f
add badgerpb3
laohanlinux Dec 28, 2022
45fd4f2
:cat:
laohanlinux Dec 28, 2022
c762b1c
:coffee:
laohanlinux Dec 29, 2022
28e0dfb
:dog:
laohanlinux Jan 2, 2023
29beed0
:coffee:
laohanlinux Jan 3, 2023
8b5a5ea
:dog:
laohanlinux Jan 3, 2023
b0db72c
Merge branch 'main' into fut/tokio
laohanlinux Jan 4, 2023
6279732
:coffee:
laohanlinux Jan 4, 2023
4ec9d92
:dog:
laohanlinux Jan 4, 2023
cecbbfc
:coffee:
laohanlinux Jan 5, 2023
f3bca94
:coffee:
laohanlinux Jan 18, 2023
e742139
:coffee:
laohanlinux Jan 19, 2023
1d4d340
?:dog:
laohanlinux Jan 30, 2023
f92bb7c
:dog:
laohanlinux Jan 31, 2023
c89a933
:coffee:
laohanlinux Feb 1, 2023
434b0a4
:dog:
laohanlinux Feb 1, 2023
26966c6
:coffee:
laohanlinux Feb 2, 2023
99254c9
fix top
laohanlinux Feb 3, 2023
d539098
add compiled
laohanlinux Feb 8, 2023
dc29adb
:sleep:
laohanlinux Feb 9, 2023
bd089a5
:sleep:
laohanlinux Feb 9, 2023
af5afe3
Merge branch 'main' into fut/tokio
laohanlinux Feb 9, 2023
e306df7
Merge branch 'main' into fut/tokio
laohanlinux Feb 9, 2023
994a99e
:card:
laohanlinux Feb 12, 2023
3a804bc
:coffee:
laohanlinux Feb 13, 2023
f2f75cf
:coffee:
laohanlinux Feb 14, 2023
4ef1557
:card:
laohanlinux Feb 14, 2023
3d5889f
:card:
laohanlinux Feb 16, 2023
0c07762
:coffee:
laohanlinux Feb 17, 2023
4c8e695
:coffee:
laohanlinux Feb 18, 2023
ec47844
:card:
laohanlinux Feb 22, 2023
7221d94
:coffee:
laohanlinux Feb 23, 2023
b37a725
:card:
laohanlinux Feb 24, 2023
502c7ac
:coffee:
laohanlinux Feb 24, 2023
fd5d06f
:card:
laohanlinux Feb 25, 2023
f82b902
:coffee:
laohanlinux Feb 25, 2023
02e2f14
:card:
laohanlinux Feb 26, 2023
f0a70e1
:coffee: add ArcLock for valueLog.buf
laohanlinux Feb 27, 2023
b682191
delete some unsafe code impl
laohanlinux Feb 27, 2023
53538a2
:coffee: add ArcLock for valueLog.buf
laohanlinux Feb 27, 2023
fb7e6d2
:coffee: add ArcLock for valueLog.buf
laohanlinux Mar 2, 2023
57d2b88
:card:
laohanlinux Mar 2, 2023
14738b0
:coffee: add ArcLock for valueLog.buf
laohanlinux Mar 4, 2023
ee0a2d5
:dog:
laohanlinux Mar 5, 2023
3944783
compiled
laohanlinux Mar 5, 2023
d7da34f
compiled
laohanlinux Mar 6, 2023
0b93273
:dog:
laohanlinux Mar 6, 2023
af4a39a
:dog:
laohanlinux Mar 7, 2023
872f663
:dog:
laohanlinux Mar 9, 2023
2ca8d3d
:dog:
laohanlinux Mar 12, 2023
23164b1
:dog:
laohanlinux Mar 14, 2023
65c0936
:dog:
laohanlinux Mar 16, 2023
7f3b7b2
:dog:
laohanlinux Mar 16, 2023
645b2f6
:coffee: add ArcLock for valueLog.buf
laohanlinux Mar 16, 2023
89a7b33
:dog:
laohanlinux Mar 16, 2023
ab13455
:dog:
laohanlinux Mar 18, 2023
fc44d4f
:dog:
laohanlinux Mar 19, 2023
3f9ba1e
:dog:
laohanlinux Mar 19, 2023
9636907
:dog:
laohanlinux Mar 20, 2023
8a6f423
:dog:
laohanlinux Mar 26, 2023
0e977f4
Merge branch 'main' into fut/async-file
laohanlinux Mar 26, 2023
0617b7f
:dog: add close for kv
laohanlinux Mar 26, 2023
5fe248d
Merge branch 'main' into fut/async-file
laohanlinux Mar 26, 2023
28f8186
:dog: add close for kv
laohanlinux Mar 27, 2023
c4f1dd6
:dog: add close for kv
laohanlinux Apr 2, 2023
b75a783
:dog: add close for kv
laohanlinux Apr 4, 2023
cec0401
:dog:
laohanlinux Apr 6, 2023
599a7dd
:dog: sleep
laohanlinux Apr 6, 2023
8a1af84
:dog: sleep
laohanlinux Apr 9, 2023
ffca0f6
:dog: sleep
laohanlinux Apr 9, 2023
1f198cd
:dog: sleep
laohanlinux Apr 10, 2023
de96f5d
:dog:
laohanlinux Apr 10, 2023
2a66ba5
:dog: sleep
laohanlinux Apr 10, 2023
1cab12f
:dog:
laohanlinux Apr 11, 2023
331aff2
:dog:
laohanlinux Apr 12, 2023
18f319b
:dog: sleep
laohanlinux Apr 12, 2023
e26c011
:dog:
laohanlinux Apr 13, 2023
acb90c2
:dog: sleep
laohanlinux Apr 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ serde = { version = "1.0.131", features = ["derive"] }
serde_json = { version = "1.0", default-features = true, features = ["alloc"] }
anyhow = "1.0.31"
thiserror = "1.0"
tokio = { version = "1.16.1", features = ["full"] }
tokio = { version = "1.16.1", features = ["full", "tracing"] }
byteorder = "1.4.3"
rand = "0.8.5"
maligned = "0.2.1"
Expand Down Expand Up @@ -47,10 +47,13 @@ eieio = "1.0.0"
either = "1.8.1"
enum-unitary = "0.5.0"
atom_box = "0.1.2"
console-subscriber = "0.1.8"
[dev-dependencies]
tracing-subscriber = "0.3.16"
tracing-log = "0.1.3"
chrono = "0.4.22"
env_logger = "0.9.1"
console_log = { version = "0.2.0", features = ["color"] }

[build]
rustflags = ["--cfg", "tokio_unstable"]
18 changes: 0 additions & 18 deletions src/db.rs

This file was deleted.

36 changes: 33 additions & 3 deletions src/iterator.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
use crate::iterator::PreFetchStatus::Prefetched;
use crate::kv::_BADGER_PREFIX;
use crate::types::{ArcMx, ArcRW, Closer, TArcMx, TArcRW};
use crate::MergeIterOverIterator;
use crate::types::{ArcMx, ArcRW, Channel, Closer, TArcMx, TArcRW};
use crate::{
kv::KV,
types::XArc,
value_log::{MetaBit, ValuePointer},
Decode, Result, Xiterator,
};
use crate::{MergeIterOverIterator, ValueStruct};
use log::Metadata;
use parking_lot::RwLock;
use std::future::Future;
use std::pin::Pin;
use std::sync::atomic::{AtomicU8, Ordering};
use std::sync::Arc;
use std::{io::Cursor, sync::atomic::AtomicU64};
use tokio::io::AsyncWriteExt;
use tokio::time::Sleep;

#[derive(Debug, PartialEq)]
pub(crate) enum PreFetchStatus {
Empty,
Prefetched,
}

type KVItem = TArcRW<KVItemInner>;
pub(crate) type KVItem = TArcRW<KVItemInner>;

// Returned during iteration. Both the key() and value() output is only valid until
// iterator.next() is called.
Expand All @@ -41,11 +43,39 @@ pub(crate) struct KVItemInner {
}

impl KVItemInner {
pub(crate) fn new(key: Vec<u8>, value: ValueStruct, kv: XArc<KV>) -> KVItemInner {
Self {
status: Arc::new(tokio::sync::RwLock::new(PreFetchStatus::Empty)),
kv,
key,
value: Arc::new(Default::default()),
vptr: value.value,
meta: value.meta,
user_meta: value.user_meta,
cas_counter: Arc::new(AtomicU64::new(value.cas_counter)),
wg: Closer::new("kv".to_owned()),
err: Ok(()),
}
}

// Returns the key. Remember to copy if you need to access it outside the iteration loop.
pub(crate) fn key(&self) -> &[u8] {
&self.key
}

pub async fn get_value(&self) -> Result<Vec<u8>> {
let ch = Channel::new(1);
self.value(|value| {
let tx = ch.tx();
Box::pin(async move {
tx.send(value).await.unwrap();
Ok(())
})
})
.await?;
Ok(ch.recv().await.unwrap())
}

// Value retrieves the value of the item from the value log. It calls the
// consumer function with a slice argument representing the value. In case
// of error, the consumer function is not called.
Expand Down
Loading