sdjournal/config.rs
1use std::time::Duration;
2
3/// Runtime configuration for `Journal`.
4#[derive(Clone, Debug)]
5pub struct JournalConfig {
6 /// Maximum object size accepted from the journal file.
7 pub max_object_size_bytes: u64,
8
9 /// Maximum bytes allowed after decompressing a DATA payload.
10 pub max_decompressed_bytes: usize,
11
12 /// Maximum length of a field name.
13 pub max_field_name_len: usize,
14
15 /// Maximum number of fields accepted per entry.
16 pub max_fields_per_entry: usize,
17
18 /// Maximum number of journal files included from a single scan.
19 pub max_journal_files: usize,
20
21 /// Maximum number of steps when traversing any `next_*` chain.
22 pub max_object_chain_steps: usize,
23
24 /// Maximum number of query terms (matches) accepted per query.
25 pub max_query_terms: usize,
26
27 /// Whether to allow mmap for `STATE_ONLINE` (potentially still being written) journal files.
28 pub allow_mmap_online: bool,
29
30 /// Whether to include `*.journal~` temporary/incomplete files during discovery.
31 pub include_journal_tilde: bool,
32
33 /// Maximum follow retry backoff.
34 pub max_follow_backoff: Duration,
35
36 /// Polling interval used as fallback when inotify is unavailable/unreliable.
37 pub poll_interval: Duration,
38}
39
40impl Default for JournalConfig {
41 fn default() -> Self {
42 Self {
43 max_object_size_bytes: 16 * 1024 * 1024,
44 max_decompressed_bytes: 1024 * 1024,
45 max_field_name_len: 128,
46 max_fields_per_entry: 256,
47 max_journal_files: 1024,
48 max_object_chain_steps: 1_000_000,
49 max_query_terms: 64,
50 allow_mmap_online: false,
51 include_journal_tilde: false,
52 max_follow_backoff: Duration::from_millis(2000),
53 poll_interval: Duration::from_millis(2000),
54 }
55 }
56}