pub trait NodeNetworkParameters:
Any
+ Debug
+ MaybeSendSync {
// Required method
fn build_transport(
&self,
delegatee_key: &DelegateeKey,
) -> Result<SharedTransport>;
// Provided methods
fn endpoint_hint(&self) -> Option<&str> { ... }
fn prepare_session_key_rotation(
&self,
_transport: &SharedTransport,
_next_key: &DelegateeKey,
) -> Result<SessionRotationCommit> { ... }
fn to_network_descriptor(&self) -> Option<NetworkConfigDescriptor> { ... }
}Expand description
Trait defining the network parameters that customize and instantiate a node’s transport (#1291).
From first principles, every interaction between a node (Processor, ProcessorBuilder,
ProcessorConfig) and its network parameters reduces to three orthogonal operations plus
optional config-descriptor projection:
- Transport instantiation (
build_transport): validates the medium’s parameters (failing closed on malformed configuration) and constructs aSharedTransportbound to the node’s initialDelegateeKey. - Advertised locator hint (
endpoint_hint): returns an optional external locator published in the node’s online presence descriptor (Noneby default for proximity ad-hoc media such as packet radio, Bluetooth ad-hoc, ultrasonic ad-hoc, or unaddressed client nodes). - Two-phase session-key rotation
(
prepare_session_key_rotation): phase 1 validates and prepares any session-bound transport credentials without mutatingtransport, returning an infallibleSessionRotationCommitclosure that phase 2 executes only after all pure validations and durable disk persistence succeed.
Required Methods§
Sourcefn build_transport(
&self,
delegatee_key: &DelegateeKey,
) -> Result<SharedTransport>
fn build_transport( &self, delegatee_key: &DelegateeKey, ) -> Result<SharedTransport>
Validate these network parameters and instantiate a SharedTransport bound to
delegatee_key.
Provided Methods§
Sourcefn endpoint_hint(&self) -> Option<&str>
fn endpoint_hint(&self) -> Option<&str>
Return the external endpoint or locator hint advertised in the node’s online presence descriptor, if any.
Defaults to None (appropriate for proximity ad-hoc media or nodes without a public locator).
Sourcefn prepare_session_key_rotation(
&self,
_transport: &SharedTransport,
_next_key: &DelegateeKey,
) -> Result<SessionRotationCommit>
fn prepare_session_key_rotation( &self, _transport: &SharedTransport, _next_key: &DelegateeKey, ) -> Result<SessionRotationCommit>
Phase 1 of two-phase session-key rotation: derive and validate transport state for
next_key without mutating transport, returning an infallible phase-2 commit closure.
§Concurrency & Lock-Ordering Contract
Both prepare_session_key_rotation and the returned SessionRotationCommit closure run
synchronously while Processor’s internal SessionKeyRing write lock is held:
- Implementations must remain synchronous and non-blocking (never awaiting network I/O).
- Implementations must not re-enter
Processormethods that read or write the session key ring (such asProcessor::signing_horizonorProcessor::renew_delegatee_key). - Phase 1 (
prepare_session_key_rotation) must not mutatetransportbefore returning, and Phase 2 (SessionRotationCommit) must be infallible.
Defaults to an empty no-op commit closure for media whose link layer does not carry session-signed credentials.
Sourcefn to_network_descriptor(&self) -> Option<NetworkConfigDescriptor>
fn to_network_descriptor(&self) -> Option<NetworkConfigDescriptor>
Project these network parameters into a tagged NetworkConfigDescriptor for lossless
serialization into ProcessorConfigSerialized, returning None if this parameter type is
purely programmatic.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl NodeNetworkParameters for TransportNetworkConfig
Implementation of NodeNetworkParameters for the built-in TransportNetworkConfig.