commonware_resolver/p2p/
config.rs

1use crate::{p2p::Producer, Consumer};
2use bytes::Bytes;
3use commonware_cryptography::PublicKey;
4use commonware_p2p::{utils::requester, Manager};
5use commonware_utils::Span;
6use std::time::Duration;
7
8/// Configuration for the peer actor.
9pub struct Config<
10    P: PublicKey,
11    D: Manager<PublicKey = P>,
12    Key: Span,
13    Con: Consumer<Key = Key, Value = Bytes, Failure = ()>,
14    Pro: Producer<Key = Key>,
15> {
16    /// Manages the current set of peers
17    pub manager: D,
18
19    /// The consumer that gets notified when data is available
20    pub consumer: Con,
21
22    /// The producer that serves data requests
23    pub producer: Pro,
24
25    /// The maximum size of the mailbox backlog
26    pub mailbox_size: usize,
27
28    /// Configuration for the requester
29    pub requester_config: requester::Config<P>,
30
31    /// How long fetches remain in the pending queue before being retried
32    pub fetch_retry_timeout: Duration,
33
34    /// Whether requests are sent with priority over other network messages
35    pub priority_requests: bool,
36
37    /// Whether responses are sent with priority over other network messages
38    pub priority_responses: bool,
39}