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
use *;
// crc: u32 4
// kind: u8 1
// seg num: u64 9 (varint)
// pid: u64 9 (varint)
// len: u64 9 (varint)
/// Log messages have a header that might eb up to this length.
pub const MAX_MSG_HEADER_LEN: usize = 32;
/// Log segments have a header of this length.
pub const SEG_HEADER_LEN: usize = 20;
/// The minimum number of items per segment.
/// Items larger than this fraction of an `io_buf`
/// will be stored as an off-log blob.
pub const MINIMUM_ITEMS_PER_SEGMENT: usize = 4;
/// During testing, this should never be exceeded.
pub const MAX_SPACE_AMPLIFICATION: f64 = 5.;
pub const META_PID: PageId = 0;
pub const COUNTER_PID: PageId = 1;
pub const BATCH_MANIFEST_PID: PageId = max_value - 666;
pub const PAGE_CONSOLIDATION_THRESHOLD: usize = 10;
pub const SEGMENT_CLEANUP_THRESHOLD: usize = 50;
// Allows for around 1 trillion items to be stored
// 2^37 * (assuming 50% node fill, 8 items per leaf)
// and well below 1% of nodes being non-leaf nodes.
pub const MAX_PID_BITS: usize = 37;
// Allows for around 32 billion items to be stored
// 2^32 * (assuming 50% node fill of 8 items per leaf)
// and well below 1% of nodes being non-leaf nodes.
// Assumed to be enough for a 32-bit system.
pub const MAX_PID_BITS: usize = 32;