1use std::path::PathBuf;
2
3#[derive(Debug, Clone)]
4pub struct Options {
5 pub dir_path: PathBuf,
7
8 pub data_file_size: u64,
10
11 pub sync_writes: bool,
13
14 pub bytes_per_sync: usize,
16
17 pub index_type: IndexType,
19
20 pub mmap_at_startup: bool,
22
23 pub file_merge_threshold: f32,
25}
26
27#[derive(Debug, Clone, PartialEq, Eq)]
28pub enum IndexType {
29 BTree,
31
32 SkipList,
34
35 BPlusTree,
37}
38
39impl Default for Options {
40 fn default() -> Self {
41 Self {
42 dir_path: std::env::temp_dir().join("bitkv-rs"),
43 data_file_size: 256 * 1024 * 1024, sync_writes: false,
45 bytes_per_sync: 0,
46 index_type: IndexType::BTree,
47 mmap_at_startup: true,
48 file_merge_threshold: 0.6,
49 }
50 }
51}
52pub struct IteratorOptions {
53 pub prefix: Vec<u8>,
54 pub reverse: bool,
55}
56
57#[allow(clippy::derivable_impls)]
58impl Default for IteratorOptions {
59 fn default() -> Self {
60 Self {
61 prefix: Default::default(),
62 reverse: false,
63 }
64 }
65}
66
67pub struct WriteBatchOptions {
68 pub max_batch_num: usize,
70
71 pub sync_writes: bool,
73}
74
75impl Default for WriteBatchOptions {
76 fn default() -> Self {
77 Self {
78 max_batch_num: 1000,
79 sync_writes: true,
80 }
81 }
82}
83
84#[derive(Debug, Clone, Copy, PartialEq, Eq)]
85pub enum IOManagerType {
86 StandardFileIO,
88
89 MemoryMap,
91}