1use std::fmt;
2use std::time::Duration;
3
4pub(crate) const MAX_MAP_SIZE: u64 = 0x0FFF_FFFF;
6
7pub(crate) const MIN_KEYS_PER_PAGE: usize = 2;
8
9#[allow(clippy::upper_case_acronyms)]
10pub(crate) type PGID = u64;
11
12#[allow(clippy::upper_case_acronyms)]
13pub(crate) type TXID = u64;
14
15pub(crate) const MAX_MMAP_STEP: u64 = 1 << 30;
16
17pub(crate) const MAGIC: u32 = 0xED0C_DAED;
19
20pub(crate) const VERSION: u32 = 2;
22
23pub(crate) const IGNORE_NOSYNC: bool = true;
25
26pub(crate) const DEFAULT_MAX_BATCH_SIZE: usize = 1000;
27
28pub(crate) const DEFAULT_MAX_BATCH_DELAY: Duration = Duration::from_millis(10000);
29bitflags! {
32 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
34 pub struct Flags: u16 {
35 const BRANCHES = 0b00001;
37 const LEAVES = 0b00010;
39 const META = 0b00100;
41 const FREELIST = 0b10000;
43 }
44}
45
46impl fmt::Display for Flags {
47 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48 let d = match *self {
49 Flags::BRANCHES => "branches".to_string(),
50 Flags::LEAVES => "leaves".to_string(),
51 Flags::META => "meta".to_string(),
52 Flags::FREELIST => "freelist".to_string(),
53 _ => panic!("unknown flag"),
54 };
55 write!(f, "{d}")
56 }
57}