-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathconfig.rs
More file actions
85 lines (71 loc) · 2.97 KB
/
config.rs
File metadata and controls
85 lines (71 loc) · 2.97 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use crate::{
types::{Epoch, Epocher, ViewDelta},
Block,
};
use commonware_cryptography::certificate::Provider;
use commonware_parallel::Bridge;
use commonware_runtime::buffer::paged::CacheRef;
use std::num::{NonZeroU64, NonZeroUsize};
/// Marshal configuration.
///
/// # Epocher and Provider Coverage
///
/// Any height marshal is asked to sync must be covered by both the
/// [epocher](Self::epocher) and the [provider](Self::provider). If
/// either returns `None` for a requested height, resolved requests will
/// be acknowledged and then dropped. If no longer needed (say a duplicate request
/// for a height we've long since processed), this drop is harmless. However, failing
/// to provide either the epocher or the provider for a height we still require to
/// process the canonical chain will lead marshal to stall (acknowledged requests
/// may not be retried).
///
/// ## Safe Pruning
///
/// Applications may prune epocher/provider entries once the last processed
/// height passes a prune target. The last processed height can be
/// derived from an `Update::Block` at height `H` as
/// `H - max_pending_acks` (the maximum backlog of blocks the application can buffer).
pub struct Config<B, P, ES, T>
where
B: Block,
P: Provider<Scope = Epoch>,
ES: Epocher,
T: Bridge,
{
/// Provider for epoch-specific signing schemes.
///
/// Must cover every epoch that contains heights the marshal will sync.
pub provider: P,
/// Configuration for epoch lengths across block height ranges.
///
/// Must cover every height the marshal will sync.
pub epocher: ES,
/// The prefix to use for all partitions.
pub partition_prefix: String,
/// Size of backfill request/response mailbox.
pub mailbox_size: usize,
/// Minimum number of views to retain temporary data after the application processes a block.
///
/// Useful for keeping around information that peers may desire to have.
pub view_retention_timeout: ViewDelta,
/// Prunable archive partition prefix.
pub prunable_items_per_section: NonZeroU64,
/// The page cache to use for the freezer journal.
pub page_cache: CacheRef,
/// The size of the replay buffer for storage archives.
pub replay_buffer: NonZeroUsize,
/// The size of the write buffer for the key journal of storage archives.
pub key_write_buffer: NonZeroUsize,
/// The size of the write buffer for the value journal of storage archives.
pub value_write_buffer: NonZeroUsize,
/// Codec configuration for block type.
pub block_codec_config: B::Cfg,
/// Maximum number of blocks to repair at once.
pub max_repair: NonZeroUsize,
/// Maximum number of blocks dispatched to the application that have not
/// yet been acknowledged. Increasing this value allows the application
/// to buffer work while marshal continues dispatching, hiding ack latency.
pub max_pending_acks: NonZeroUsize,
/// Strategy for parallel operations.
pub strategy: T,
}