1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
extern crate libc;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate bincode;
extern crate time;
extern crate rand;
pub use db::DB;
pub use tree::{FANOUT, Tree};
pub use page::{Materializer, PageCache};
pub use log::{HEADER_LEN, LockFreeLog, Log, MAX_BUF_SZ, N_BUFS};
pub use stack::Stack;
pub use radix::Radix;
use crc16::crc16_arr;
macro_rules! rep_no_copy {
($e:expr; $n:expr) => {
{
let mut v = Vec::with_capacity($n);
for _ in 0..$n {
v.push($e);
}
v
}
};
}
#[cfg(test)]
fn test_fail() -> bool {
use rand::Rng;
rand::thread_rng().gen::<bool>();
false
}
#[cfg(not(test))]
#[inline(always)]
fn test_fail() -> bool {
false
}
mod db;
mod tree;
mod bound;
mod log;
mod crc16;
mod stack;
mod page;
mod radix;
pub mod ops;
use bound::Bound;
use stack::{StackIter, node_from_frag_vec};
use tree::Frag;
type LogID = u64;
type PageID = usize;
type Key = Vec<u8>;
type Value = Vec<u8>;
#[inline(always)]
fn raw<T>(t: T) -> *const T {
Box::into_raw(Box::new(t)) as *const T
}