Skip to main content

NodeNetworkParameters

Trait NodeNetworkParameters 

Source
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:

  1. Transport instantiation (build_transport): validates the medium’s parameters (failing closed on malformed configuration) and constructs a SharedTransport bound to the node’s initial DelegateeKey.
  2. Advertised locator hint (endpoint_hint): returns an optional external locator published in the node’s online presence descriptor (None by default for proximity ad-hoc media such as packet radio, Bluetooth ad-hoc, ultrasonic ad-hoc, or unaddressed client nodes).
  3. Two-phase session-key rotation (prepare_session_key_rotation): phase 1 validates and prepares any session-bound transport credentials without mutating transport, returning an infallible SessionRotationCommit closure that phase 2 executes only after all pure validations and durable disk persistence succeed.

Required Methods§

Source

fn build_transport( &self, delegatee_key: &DelegateeKey, ) -> Result<SharedTransport>

Validate these network parameters and instantiate a SharedTransport bound to delegatee_key.

Provided Methods§

Source

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).

Source

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 Processor methods that read or write the session key ring (such as Processor::signing_horizon or Processor::renew_delegatee_key).
  • Phase 1 (prepare_session_key_rotation) must not mutate transport before 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.

Source

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§