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
impl MigrationSubprotocolHandler
Sourcepub fn new(
orchestrator: Arc<MigrationOrchestrator>,
source_handler: Arc<MigrationSourceHandler>,
target_handler: Arc<MigrationTargetHandler>,
local_node_id: u64,
) -> Self
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.
Sourcepub fn with_hooks(
orchestrator: Arc<MigrationOrchestrator>,
source_handler: Arc<MigrationSourceHandler>,
target_handler: Arc<MigrationTargetHandler>,
local_node_id: u64,
hooks: MigrationHandlerHooks,
) -> Self
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.
Sourcepub fn handle_message(
&self,
data: &[u8],
from_node: u64,
) -> Result<Vec<OutboundMigrationMessage>, MigrationError>
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.
Sourcepub fn orchestrator(&self) -> &Arc<MigrationOrchestrator> ⓘ
pub fn orchestrator(&self) -> &Arc<MigrationOrchestrator> ⓘ
Get a reference to the orchestrator.
Sourcepub fn source_handler(&self) -> &Arc<MigrationSourceHandler> ⓘ
pub fn source_handler(&self) -> &Arc<MigrationSourceHandler> ⓘ
Get a reference to the source handler.
Sourcepub fn target_handler(&self) -> &Arc<MigrationTargetHandler> ⓘ
pub fn target_handler(&self) -> &Arc<MigrationTargetHandler> ⓘ
Get a reference to the target handler.