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
use crate::PageStoreOptions;

/// Options to configure a table.
#[non_exhaustive]
#[derive(Clone, Debug)]
pub struct Options {
    /// Approximate size of user data packed per page before it is split.
    ///
    /// Note that the size specified here corresponds to uncompressed data.
    ///
    /// Default: 8KB
    pub page_size: usize,

    /// Approximate number of delta pages chained per page before it is
    /// consolidated.
    ///
    /// Default: 4
    pub page_chain_length: usize,

    /// Options for the underlying page store.
    pub page_store: PageStoreOptions,
}

impl Default for Options {
    fn default() -> Self {
        Self {
            page_size: 8 << 10,
            page_chain_length: 4,
            page_store: PageStoreOptions::default(),
        }
    }
}

/// Options to configure the behavior of reads.
#[non_exhaustive]
#[derive(Clone, Debug)]
pub struct ReadOptions {
    /// The maximum visible LSN for this read.
    ///
    /// Keys with larger LSNs will be ignored in this read.
    ///
    /// Default: `u64::MAX`
    pub max_lsn: u64,

    /// Whether to fill pages load from store to the page cache.
    ///
    /// Default: true
    pub fill_cache: bool,
}

impl Default for ReadOptions {
    fn default() -> Self {
        Self {
            max_lsn: u64::MAX,
            fill_cache: true,
        }
    }
}

/// Options to configure the behavior of writes.
#[non_exhaustive]
#[derive(Clone, Debug)]
pub struct WriteOptions {}