Weave documentation
Rust referenceweave-swarm

weave-swarm · runtime

Source declarations, signatures and documentation for runtime.

Source: sigil/weave/network/weave-swarm/src/runtime/mod.rs. SHA-256: 757470c1e774f7e378a4ea1ccee5678471a705e348e07ca9d8258df96fdb44c9.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

pub use activation::{EndpointProfile, MinimumPrivacyProfile, RuntimeActivationV1};

pub use activation::{EndpointProfile, MinimumPrivacyProfile, RuntimeActivationV1};

Source line: 27.

pub use backend::{BackendCloseDisposition, CloseId, ConnectionId, DialAttemptId, StreamId};

pub use backend::{BackendCloseDisposition, CloseId, ConnectionId, DialAttemptId, StreamId};

Source line: 28.

pub use limits::RuntimeLimits;

pub use limits::RuntimeLimits;

Source line: 36.

pub use protocol::{ProtocolId, ProtocolRegistry};

pub use protocol::{ProtocolId, ProtocolRegistry};

Source line: 38.

pub use registry::ConnectionRegistry;

pub use registry::ConnectionRegistry;

Source line: 39.

pub use substream::{

AuthenticatedSubstream, CanonicalTransportPeerId, RoleOrderedTransportPeerIds, TransportRole, };

pub use substream::{
    AuthenticatedSubstream, CanonicalTransportPeerId, RoleOrderedTransportPeerIds, TransportRole,
};

Source line: 40.

runtime::CommandId

Monotonic local command identifier.

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CommandId(u64);

Source line: 47.

runtime::CommandId::get

pub fn get(self) -> u64;

Source line: 50.

runtime::OperationId

Correlation identity for one asynchronous runtime operation.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OperationId {
    Dial(DialAttemptId),
    StreamOpen(StreamId),
    StreamClose(CloseId),
}

Source line: 57.

runtime::OperationOutcome

Exactly one typed terminal outcome for a submitted asynchronous operation.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OperationOutcome {
    Succeeded,
    Failed(RuntimeEventCode),
    Cancelled(RuntimeEventCode),
}

Source line: 65.

runtime::RuntimeCommand

Commands accepted by the bounded runtime actor.

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum RuntimeCommand {
    Dial {
        peer_id: PeerId,
    },
    Disconnect {
        peer_id: PeerId,
    },
    OpenApplicationStream {
        peer_id: PeerId,
        protocol: ProtocolId,
    },
    DhtQuery {
        query_id: u64,
        key: [u8; 32],
    },
    BlockPeer {
        peer_id: PeerId,
    },
    UnblockPeer {
        peer_id: PeerId,
    },
    Shutdown,
}

Source line: 73.

runtime::CommandDisposition

Per-command disposition.

Queued is deliberately not a success claim: it applies to commands whose backend work has only entered the bounded backend queue. Completed is used only when a correlated asynchronous operation reached a typed terminal transition.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CommandDisposition {
    Queued,
    Completed {
        operation_id: Option<OperationId>,
        outcome: OperationOutcome,
    },
}

Source line: 104.

runtime::CommandResult

Result for one command: either honest queue admission or a terminal outcome.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CommandResult {
pub command_id: CommandId,
pub disposition: CommandDisposition
}

Source line: 114.

runtime::CommandReceipt

Receipt returned by nonblocking command submission.

pub struct CommandReceipt {

}

Source line: 120.

runtime::CommandReceipt::command_id

pub fn command_id(&self) -> CommandId;

Source line: 126.

runtime::CommandReceipt::result

pub async fn result(self) -> Result<CommandResult, RuntimeError>;

Source line: 130.

runtime::RuntimeEvent

Critical state events. Normal capacity is finite and a fatal slot is reserved.

pub enum RuntimeEvent<S>
where
    S: AsyncRead + AsyncWrite + Unpin + Send + 'static,
{
    Activated {
        peer_id: CanonicalTransportPeerId,
    },
    CommandRejected {
        command_id: CommandId,
        peer_id: Option<PeerId>,
        code: RuntimeEventCode,
    },
    OperationRejected {
        operation_id: Option<OperationId>,
        peer_id: Option<PeerId>,
        code: RuntimeEventCode,
    },
    Fatal {
        operation_id: Option<OperationId>,
        code: RuntimeEventCode,
    },
    ConnectionEstablished {
        peer_id: PeerId,
        connection_id: ConnectionId,
    },
    ConnectionClosed {
        peer_id: PeerId,
        connection_id: ConnectionId,
    },
    DialCompleted {
        command_id: CommandId,
        attempt_id: DialAttemptId,
        peer_id: PeerId,
        outcome: OperationOutcome,
    },
    ApplicationSubstreamOpened {
        command_id: Option<CommandId>,
        peer_id: PeerId,
        substream: AuthenticatedSubstream<S>,
    },
    /// Terminal non-success for an outbound open. `outcome` preserves whether
    /// the physical terminal was a failure or a requested cancellation.
    ApplicationStreamOpenFailed {
        command_id: CommandId,
        peer_id: PeerId,
        stream_id: StreamId,
        outcome: OperationOutcome,
    },
    ApplicationStreamCloseCompleted {
        close_id: CloseId,
        peer_id: PeerId,
        connection_id: ConnectionId,
        stream_id: Option<StreamId>,
        outcome: OperationOutcome,
    },
    ApplicationStreamTerminated {
        peer_id: PeerId,
        connection_id: ConnectionId,
        stream_id: StreamId,
        code: Option<RuntimeEventCode>,
    },
    DhtActivity {
        peer_id: PeerId,
        connection_id: ConnectionId,
        query_id: u64,
    },
    Stopped,
}

Source line: 138.

runtime::RuntimeHandle

Backpressured command handle for the one actor.

pub struct RuntimeHandle {

}

Source line: 330.

runtime::RuntimeHandle::peer_id

pub fn peer_id(&self) -> PeerId;

Source line: 339.

runtime::RuntimeHandle::transport_peer_id

pub fn transport_peer_id(&self) -> &CanonicalTransportPeerId;

Source line: 343.

runtime::RuntimeHandle::command

pub async fn command(&self, command: RuntimeCommand) -> Result<CommandResult, RuntimeError>;

Source line: 347.

runtime::RuntimeHandle::try_command

pub fn try_command(&self, command: RuntimeCommand) -> Result<CommandReceipt, RuntimeError>;

Source line: 358.

runtime::RuntimeHandle::stopped

pub async fn stopped(self) -> Result<(), RuntimeError>;

Source line: 369.

runtime::RuntimeEvents

Single-consumer critical-event stream.

pub struct RuntimeEvents<S>
where
    S: AsyncRead + AsyncWrite + Unpin + Send + 'static, {

}

Source line: 408.

runtime::RuntimeEvents<S>::recv

pub async fn recv(&mut self) -> Option<RuntimeEvent<S>>;

Source line: 419.

On this page