commonware_resolver/p2p/
config.rs

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