use std::fmt;
use std::time::Duration;
pub(crate) const MAX_MAP_SIZE: u64 = 0x0FFF_FFFF;
pub(crate) const MIN_KEYS_PER_PAGE: usize = 2;
#[allow(clippy::upper_case_acronyms)]
pub(crate) type PGID = u64;
#[allow(clippy::upper_case_acronyms)]
pub(crate) type TXID = u64;
pub(crate) const MAX_MMAP_STEP: u64 = 1 << 30;
pub(crate) const MAGIC: u32 = 0xED0C_DAED;
pub(crate) const VERSION: u32 = 2;
pub(crate) const IGNORE_NOSYNC: bool = true;
pub(crate) const DEFAULT_MAX_BATCH_SIZE: usize = 1000;
pub(crate) const DEFAULT_MAX_BATCH_DELAY: Duration = Duration::from_millis(10000);
bitflags! {
pub struct Flags: u16 {
const BRANCHES = 0b00001;
const LEAVES = 0b00010;
const META = 0b00100;
const FREELIST = 0b10000;
}
}
impl fmt::Display for Flags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let d = match *self {
Flags::BRANCHES => "branches".to_string(),
Flags::LEAVES => "leaves".to_string(),
Flags::META => "meta".to_string(),
Flags::FREELIST => "freelist".to_string(),
_ => panic!("unknown flag"),
};
write!(f, "{}", d)
}
}