commonware_resolver/p2p/
config.rs

1use crate::{p2p::Producer, Consumer};
2use bytes::Bytes;
3use commonware_cryptography::PublicKey;
4use commonware_p2p::{Blocker, 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    B: Blocker<PublicKey = P>,
13    Key: Span,
14    Con: Consumer<Key = Key, Value = Bytes, Failure = ()>,
15    Pro: Producer<Key = Key>,
16> {
17    /// Manages the current set of peers
18    pub manager: D,
19
20    /// The blocker that will be used to block peers that send invalid responses
21    pub blocker: B,
22
23    /// The consumer that gets notified when data is available
24    pub consumer: Con,
25
26    /// The producer that serves data requests
27    pub producer: Pro,
28
29    /// The maximum size of the mailbox backlog
30    pub mailbox_size: usize,
31
32    /// Local identity of the participant (if any).
33    pub me: Option<P>,
34
35    /// Initial expected performance for new participants.
36    pub initial: Duration,
37
38    /// Timeout for requests.
39    pub timeout: Duration,
40
41    /// How long fetches remain in the pending queue before being retried
42    pub fetch_retry_timeout: Duration,
43
44    /// Whether requests are sent with priority over other network messages
45    pub priority_requests: bool,
46
47    /// Whether responses are sent with priority over other network messages
48    pub priority_responses: bool,
49}