pub struct NetworkConfigBuilder { /* private fields */ }Expand description
Builder for NetworkConfig.
data_dir, network_id and schema_id are required; everything else has
sensible defaults.
Implementations§
Source§impl NetworkConfigBuilder
impl NetworkConfigBuilder
Sourcepub fn data_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn data_dir(self, dir: impl Into<PathBuf>) -> Self
Sets the directory where the persistent peer identity is stored.
Sourcepub fn network_id(self, network_id: NetworkId) -> Self
pub fn network_id(self, network_id: NetworkId) -> Self
Sets the network identifier.
Sourcepub fn max_message_size(self, size: usize) -> Self
pub fn max_message_size(self, size: usize) -> Self
Sets the maximum size in bytes of a single encoded domain message.
Sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Sets the timeout applied to handshakes and message round-trips.
Sourcepub fn event_channel_capacity(self, capacity: usize) -> Self
pub fn event_channel_capacity(self, capacity: usize) -> Self
Sets the capacity of the bounded event channel.
Sourcepub fn max_concurrent_streams_per_peer(self, limit: usize) -> Self
pub fn max_concurrent_streams_per_peer(self, limit: usize) -> Self
Sets the maximum number of concurrently processed streams per peer.
Sourcepub fn rendezvous(self, rendezvous: RendezvousConfig) -> Self
pub fn rendezvous(self, rendezvous: RendezvousConfig) -> Self
Enables automatic peer discovery over the mainline DHT.
Sourcepub fn stream_protocol(self, alpn: impl Into<Vec<u8>>) -> Self
pub fn stream_protocol(self, alpn: impl Into<Vec<u8>>) -> Self
Declares an auxiliary ALPN protocol on which this peer accepts raw
byte streams (see crate::NetworkEngine::stream_acceptor). May be
called multiple times, once per protocol.
Sourcepub fn schema_independent_stream_protocol(
self,
alpn: impl Into<Vec<u8>>,
) -> Self
pub fn schema_independent_stream_protocol( self, alpn: impl Into<Vec<u8>>, ) -> Self
Declares an auxiliary ALPN protocol that validates the network and federation transport version, but deliberately does not require the application schema id to match.
This is suitable for bounded, self-versioned capability discovery protocols that must remain reachable across schema upgrades.
Sourcepub fn build(self) -> Result<NetworkConfig>
pub fn build(self) -> Result<NetworkConfig>
Validates the configuration and builds a NetworkConfig.
Trait Implementations§
Source§impl Clone for NetworkConfigBuilder
impl Clone for NetworkConfigBuilder
Source§impl Debug for NetworkConfigBuilder
impl Debug for NetworkConfigBuilder
Auto Trait Implementations§
impl Freeze for NetworkConfigBuilder
impl RefUnwindSafe for NetworkConfigBuilder
impl Send for NetworkConfigBuilder
impl Sync for NetworkConfigBuilder
impl Unpin for NetworkConfigBuilder
impl UnsafeUnpin for NetworkConfigBuilder
impl UnwindSafe for NetworkConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more