Skip to main content

MigrationSubprotocolHandler

Struct MigrationSubprotocolHandler 

Source
pub struct MigrationSubprotocolHandler { /* private fields */ }
Expand description

Dispatcher for migration subprotocol (0x0500) messages.

Wraps the three handler halves — orchestrator, source, target — plus the optional cross-cutting hooks that let the SDK drive identity-envelope seal/open, channel-re-bind replay, source-side Unsubscribe teardown, runtime-readiness gating, and source-side failure observation. Constructed by the SDK’s DaemonRuntime::start via Self::with_hooks; tests use Self::new when they don’t need any hooks.

Install onto a MeshNode via MeshNode::set_migration_handler.

Implementations§

Source§

impl MigrationSubprotocolHandler

Source

pub fn new( orchestrator: Arc<MigrationOrchestrator>, source_handler: Arc<MigrationSourceHandler>, target_handler: Arc<MigrationTargetHandler>, local_node_id: u64, ) -> Self

Create a new handler with no hooks wired. Envelopes on inbound snapshots are ignored; outbound snapshots don’t carry an envelope; readiness is treated as always-ready; no failure observer; no channel-re-bind callbacks. Matches the pre-Stage-5b behaviour and is the right shape for tests that only need the bare three-handler dispatcher.

Source

pub fn with_hooks( orchestrator: Arc<MigrationOrchestrator>, source_handler: Arc<MigrationSourceHandler>, target_handler: Arc<MigrationTargetHandler>, local_node_id: u64, hooks: MigrationHandlerHooks, ) -> Self

Create a handler with an explicit MigrationHandlerHooks bundle. Each hook field is independently optional; the SDK supplies all five at once from DaemonRuntime::start, tests populate only the subset they need.

Source

pub fn handle_message( &self, data: &[u8], from_node: u64, ) -> Result<Vec<OutboundMigrationMessage>, MigrationError>

Handle an inbound migration message.

Returns zero or more outbound messages to send to other nodes.

Source

pub fn orchestrator(&self) -> &Arc<MigrationOrchestrator>

Get a reference to the orchestrator.

Source

pub fn source_handler(&self) -> &Arc<MigrationSourceHandler>

Get a reference to the source handler.

Source

pub fn target_handler(&self) -> &Arc<MigrationTargetHandler>

Get a reference to the target handler.

Trait Implementations§

Source§

impl Debug for MigrationSubprotocolHandler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more