Skip to main content

commonware_consensus/marshal/
config.rs

1use crate::{
2    types::{Epoch, Epocher, ViewDelta},
3    Block,
4};
5use commonware_cryptography::certificate::Provider;
6use commonware_parallel::Strategy;
7use commonware_runtime::buffer::paged::CacheRef;
8use std::num::{NonZeroU64, NonZeroUsize};
9
10/// Marshal configuration.
11pub struct Config<B, P, ES, T>
12where
13    B: Block,
14    P: Provider<Scope = Epoch>,
15    ES: Epocher,
16    T: Strategy,
17{
18    /// Provider for epoch-specific signing schemes.
19    pub provider: P,
20
21    /// Configuration for epoch lengths across block height ranges.
22    pub epocher: ES,
23
24    /// The prefix to use for all partitions.
25    pub partition_prefix: String,
26
27    /// Size of backfill request/response mailbox.
28    pub mailbox_size: usize,
29
30    /// Minimum number of views to retain temporary data after the application processes a block.
31    ///
32    /// Useful for keeping around information that peers may desire to have.
33    pub view_retention_timeout: ViewDelta,
34
35    /// Prunable archive partition prefix.
36    pub prunable_items_per_section: NonZeroU64,
37
38    /// The page cache to use for the freezer journal.
39    pub page_cache: CacheRef,
40
41    /// The size of the replay buffer for storage archives.
42    pub replay_buffer: NonZeroUsize,
43
44    /// The size of the write buffer for the key journal of storage archives.
45    pub key_write_buffer: NonZeroUsize,
46
47    /// The size of the write buffer for the value journal of storage archives.
48    pub value_write_buffer: NonZeroUsize,
49
50    /// Codec configuration for block type.
51    pub block_codec_config: B::Cfg,
52
53    /// Maximum number of blocks to repair at once.
54    pub max_repair: NonZeroUsize,
55
56    /// Strategy for parallel operations.
57    pub strategy: T,
58}