Skip to main content

EngineState

Struct EngineState 

Source
pub struct EngineState<S>
where S: StorageLayout,
{ pub resource_open_lane: ResourceOpenLane, /* private fields */ }

Fields§

§resource_open_lane: ResourceOpenLane

Implementations§

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn blackholed_identity_count(&self) -> usize

Source

pub fn is_identity_blackholed(&self, identity: &IdentityHash) -> bool

Source

pub fn blackholed_identities( &self, ) -> impl Iterator<Item = BlackholedIdentity<&str>>

Source

pub fn blackhole_identity( &mut self, entry: BlackholedIdentity<&str>, interfaces: AttachedInterfaces<'_>, on_removed: &mut impl FnMut(RemovedRoute), ) -> BlackholeIdentityEffect

Source

pub fn unblackhole_identity( &mut self, identity: &IdentityHash, ) -> UnblackholeIdentityEffect

Source

pub fn seed_blackholed_identities<Reason>( &mut self, entries: impl IntoIterator<Item = BlackholedIdentity<Reason>>, now: InstantMillis, interfaces: AttachedInterfaces<'_>, on_removed: &mut impl FnMut(RemovedRoute), ) -> BlackholeSeedEffect
where Reason: AsRef<str>,

Source

pub fn cull_expired_blackholes(&mut self, now: InstantMillis) -> WakeSchedules

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_command_into<F>( &mut self, issued: IssuedCommand, interfaces: AttachedInterfaces<'_>, now: InstantMillis, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

Source

pub fn complete_send_single_packet_deferred( &mut self, owed: EncryptOwed, ephemeral_public: X25519PublicKey, shared: X25519SharedSecret, interfaces: AttachedInterfaces<'_>, buf: &mut [u8], sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_command( &mut self, issued: IssuedCommand, interfaces: AttachedInterfaces<'_>, ) -> CommandOutcome

Source

pub fn interface_counts(&self, interface: InterfaceId) -> InterfaceCounts

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn settle_timed_out_receipts( &mut self, now: InstantMillis, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

Source

pub fn settle_timed_out_path_requests( &mut self, now: InstantMillis, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

Source

pub fn cull_expired_routes( &mut self, now: InstantMillis, interfaces: AttachedInterfaces<'_>, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

The reference’s two cull arms (RNS 1.4.2 Transport.jobs): RouteRemovalCause::Expired for the aged, RouteRemovalCause::InterfaceGone for the orphaned. The orphan arm is softened by the crate::routing::warmth::DepartedInterfaces grace; the reverse-route and transported-link culls below stay eager like the reference’s, since they carry in-flight work that a bounced lane kills regardless.

Source

pub fn fire_due_scheduled_announces( &mut self, now: InstantMillis, interfaces: AttachedInterfaces<'_>, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn visit_announce_rate_states(&self, visit: impl FnMut(AnnounceRateState))

Source

pub fn visit_route_snapshots( &self, interfaces: AttachedInterfaces<'_>, visit: impl FnMut(RouteSnapshot), )

Source

pub fn route_snapshot( &self, destination: DestinationHash, interfaces: AttachedInterfaces<'_>, ) -> Option<RouteSnapshot>

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn drop_route( &mut self, destination: &DestinationHash, interfaces: AttachedInterfaces<'_>, ) -> DropRouteEffect

Source

pub fn drop_routes_via( &mut self, transport: TransportId, interfaces: AttachedInterfaces<'_>, on_removed: &mut impl FnMut(RemovedRoute), ) -> DropRoutesViaEffect

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn resume_announce( &mut self, owed: AnnounceVerifyOwed, interfaces: AttachedInterfaces<'_>, fill_entropy: &mut impl FnMut(&mut [u8]), sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn resume_decrypt( &mut self, owed: DecryptOwed, shared: X25519SharedSecret, interfaces: AttachedInterfaces<'_>, should_prove: &mut impl FnMut(&ProofRequest<'_>) -> bool, deferred_sign: &mut Option<DeferredProofSign>, sink: &mut impl FnMut(EngineReaction<'_>), )

Source

pub fn resume_ratchet_decrypt( &mut self, owed: RatchetDecryptOwed, opened: OpenedToken<'_>, interfaces: AttachedInterfaces<'_>, should_prove: &mut impl FnMut(&ProofRequest<'_>) -> bool, deferred_sign: &mut Option<DeferredProofSign>, sink: &mut impl FnMut(EngineReaction<'_>), )

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn fire_due_held_announces<F>( &mut self, now: InstantMillis, interfaces: AttachedInterfaces<'_>, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

RNS 1.4.2 Interface.process_held_announces.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_packet_into<F, P, A, K>( &mut self, packet: InboundPacket<'_>, io: IngestIo<'_, F, P, A, K>, ) -> WakeSchedules
where F: FnMut(&mut [u8]), P: FnMut(&ProofRequest<'_>) -> bool, A: FnMut(&ResourceOffer) -> bool, K: FnMut(EngineReaction<'_>),

Source

pub fn ingest_classified_into<F, P, A, K>( &mut self, packet: ClassifiedInboundPacket<'_>, io: IngestIo<'_, F, P, A, K>, ) -> WakeSchedules
where F: FnMut(&mut [u8]), P: FnMut(&ProofRequest<'_>) -> bool, A: FnMut(&ResourceOffer) -> bool, K: FnMut(EngineReaction<'_>),

Source

pub fn ingest_packet_into_deferring<F, P, A, K>( &mut self, packet: InboundPacket<'_>, io: IngestIo<'_, F, P, A, K>, deferred_sign: &mut Option<DeferredProofSign>, deferred: Option<&mut DeferredCrypto>, ) -> WakeSchedules
where F: FnMut(&mut [u8]), P: FnMut(&ProofRequest<'_>) -> bool, A: FnMut(&ResourceOffer) -> bool, K: FnMut(EngineReaction<'_>),

Source

pub fn ingest_classified_into_deferring<F, P, A, K>( &mut self, packet: ClassifiedInboundPacket<'_>, io: IngestIo<'_, F, P, A, K>, deferred_sign: &mut Option<DeferredProofSign>, deferred: Option<&mut DeferredCrypto>, ) -> WakeSchedules
where F: FnMut(&mut [u8]), P: FnMut(&ProofRequest<'_>) -> bool, A: FnMut(&ResourceOffer) -> bool, K: FnMut(EngineReaction<'_>),

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn write_proof( &self, owed: &ProofOwed, buf: &mut [u8], ) -> Result<usize, WriteProofError>

Best-effort by RNS 1.4.2 parity: an unwritable proof is dropped; the sender’s timeout-and-resend is the designed recovery, so nothing here is retried.

Source

pub fn write_signed_proof( &self, packet_hash: &PacketHash, signature: &Ed25519Signature, buf: &mut [u8], ) -> Result<usize, WireError>

Best-effort by RNS 1.4.2 parity: an unwritable link proof is dropped; the initiator’s timeout is the designed recovery.

Source

pub fn write_channel_ack( &self, link_id: &LinkId, packet_hash: &PacketHash, buf: &mut [u8], ) -> Result<usize, WriteChannelAckError>

RNS 1.4.2 Link.receive’s CHANNEL branch: packet.prove() whenever a channel is open, on either side.

Source

pub fn settle_receipt_proof( &mut self, payload: &[u8], proof_packet_hash: PacketHash, arrived_at: InstantMillis, ) -> ProofIngest

RNS 1.4.2 PacketReceipt.validate_proof, both forms. Settlement removes the receipt, so a replayed proof finds nothing; exactly-once is structural.

Source

pub fn settle_receipt_proof_deferred( &mut self, payload: &[u8], proof_destination: &DestinationHash, proof_packet_hash: PacketHash, arrived_at: InstantMillis, ) -> Option<DeferredProof>

Source

pub fn settle_resolved( &mut self, command_id: CommandId, ) -> Option<ProvenReceipt>

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn register_plain_destination( &mut self, app_name: &str, aspects: &[&str], ) -> Result<DestinationHash, RegisterDestinationError>

Source

pub fn register_single_destination( &mut self, identity: &IdentityHash, app_name: &str, aspects: &[&str], app_data: &[u8], proof_strategy: ProofStrategy, link_request_policy: LinkRequestPolicy, ratchet_policy: RatchetPolicy, ) -> Result<DestinationHash, RegisterDestinationError>

Source

pub fn register_group_destination( &mut self, identity: &IdentityHash, app_name: &str, aspects: &[&str], shared_key: &[u8], ) -> Result<DestinationHash, RegisterDestinationError>

RNS 1.4.2 GROUP (type 0x01): identity is addressing material only: a GROUP never announces, proves, or ratchets.

Source

pub fn hold_identity( &mut self, identity_secret_key: Zeroizing<[u8; 64]>, ) -> Result<IdentityHash, HoldIdentityError>

Source

pub fn held_identity_hashes(&self) -> &[IdentityHash]

Source

pub fn set_transport_identity( &mut self, identity: &IdentityHash, ) -> Result<(), SetTransportIdentityError>

Source

pub fn set_non_routing_identity( &mut self, identity: &IdentityHash, ) -> Result<(), SetTransportIdentityError>

Source

pub fn set_shared_instance_identity( &mut self, identity: &IdentityHash, ) -> Result<(), SetTransportIdentityError>

Source

pub const fn transport_id(&self) -> Option<TransportId>

Source

pub const fn network_transport_enabled(&self) -> bool

Source

pub fn upstream_app_destinations( &self, ) -> impl Iterator<Item = UpstreamAppDestination>

Source

pub fn set_default_resource_strategy( &mut self, destination: &DestinationHash, strategy: ResourceStrategy, ) -> bool

RNS 1.4.2 apps set Link.resource_strategy in the link-established callback, a de facto per-destination default; stamping at activation outraces a sender’s instant advertise.

Source

pub fn set_maximum_request_bytes( &mut self, destination: &DestinationHash, maximum: ByteLimit, ) -> bool

Source

pub fn register_request_handler( &mut self, destination: &DestinationHash, path: &str, policy: RequestPolicy, ) -> Result<(), TablePushError>

RNS 1.4.2 Destination.register_request_handler; last write wins, and a re-registration starts from an empty allow list.

Source

pub fn register_request_handler_hash( &mut self, destination: &DestinationHash, path_hash: RequestPathHash, policy: RequestPolicy, ) -> Result<(), TablePushError>

Register a request handler when the host has already derived the protocol path hash.

Source

pub fn unregister_request_handler_hash( &mut self, destination: &DestinationHash, path_hash: &RequestPathHash, ) -> bool

Remove a runtime request handler. Requests already admitted before this mutation may still reach the application router; callers that need an immediate content cutoff should update their application state first.

Source

pub fn allow_requester( &mut self, destination: &DestinationHash, path: &str, identity: IdentityHash, ) -> Result<(), RequestHandlerError>

Admit one identified peer to an RequestPolicy::AllowList handler (RNS 1.4.2’s allowed_list)

Source

pub fn disallow_requester( &mut self, destination: &DestinationHash, path: &str, identity: &IdentityHash, ) -> Result<(), RequestHandlerError>

Source

pub fn persisted_route_rows( &self, ) -> impl Iterator<Item = PersistedRouteRow<'_>>

Every routing-table row in the shape the persistence codec carries, for a host’s flush pass.

Source

pub fn persisted_route_destinations( &self, ) -> impl Iterator<Item = DestinationHash>

Source

pub fn persisted_route_row( &self, destination: &DestinationHash, ) -> Option<PersistedRouteRow<'_>>

Source

pub fn seed_route( &mut self, row: &PersistedRouteRow<'_>, now: InstantMillis, ) -> RouteSeedOutcome

Boot-restore for one snapshot row, refusing what storage may have forged: the address binding re-derives and the announce signature re-verifies before anything lands. RNS 1.4.2’s load path instead re-reads the cached announce packet and counts the cache read as a hop (announce_packet.hops += 1); seeding writes the row directly, so hops carries verbatim. A seeded row’s interface gets the departed grace (Departure::MayReturn), holding the route warm until the medium re-derives the same id at attach.

Source

pub fn prepare_persisted_route<'a>( &self, row: PersistedRouteRow<'a>, ) -> Result<PersistedRouteSignaturePending<'a>, PersistedRoutePreflightError>

Source

pub fn seed_verified_route( &mut self, verified: VerifiedPersistedRoute<'_>, now: InstantMillis, ) -> RouteSeedOutcome

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn persisted_self_ratchet_rows( &self, ) -> impl Iterator<Item = (DestinationHash, LastRotated, &[X25519SecretKey])>

Source

pub fn persisted_self_ratchet_row( &self, destination: &DestinationHash, ) -> Option<(LastRotated, &[X25519SecretKey])>

Source

pub fn seed_self_ratchets( &mut self, destination: &DestinationHash, last_rotated: LastRotated, secrets_newest_first: impl DoubleEndedIterator<Item = X25519SecretKey>, ) -> SeedSelfRatchetsOutcome

Boot-restore after the recipe re-registers its destinations: only a destination this boot tracks as ratcheted accepts its stored record, and live secrets win over storage.

Source

pub fn replace_persisted_self_ratchets( &mut self, destination: &DestinationHash, last_rotated: LastRotated, secrets_newest_first: impl DoubleEndedIterator<Item = X25519SecretKey>, ) -> SeedSelfRatchetsOutcome

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn set_protocol_policy(&mut self, policy: EngineProtocolPolicy)

Source

pub fn new(identity_secret_key: Zeroizing<[u8; 64]>) -> EngineState<S>

§Panics

Panics if S declares a zero-capacity held-identities column; such a layout cannot run a node.

Source

pub const fn ingested_packet_count(&self) -> u64

Source

pub const fn ingested_command_count(&self) -> u64

Source

pub fn metrics_snapshot(&self) -> EngineMetricsSnapshot

Source

pub fn route_count(&self) -> usize

Source

pub fn route_count_via(&self, interface: InterfaceId) -> usize

Source

pub fn take_dirty_interfaces(&mut self) -> <S as StorageLayout>::DirtyInterfaces

Source

pub fn interface_attached(&mut self, interface: InterfaceId, now: InstantMillis)

Source

pub fn interface_departed( &mut self, interface: InterfaceId, departure: Departure, now: InstantMillis, )

Source

pub fn scheduled_announce_count(&self) -> usize

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn persisted_tunnel_rows(&self) -> impl Iterator<Item = PersistedTunnelRow>

Source

pub fn seed_tunnel(&mut self, row: PersistedTunnelRow) -> SeedTunnelOutcome

Unlike seed_route there is nothing to re-verify: a tunnel row carries no keys, so the worst a hostile store plants is warmth on a dead interface, bounded by the row’s own expiry.

Source

pub fn write_tunnel_synthesize( &self, interface: InterfaceId, random_hash: &[u8; 16], buf: &mut [u8], ) -> Result<usize, WriteTunnelSynthesizeError>

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn scheduled_announces_wake(&self) -> WakeSchedule

Source

pub fn receipt_timeouts_wake(&self) -> WakeSchedule

Source

pub fn path_request_timeouts_wake(&self) -> WakeSchedule

Source

pub fn resource_deadlines_wake(&self) -> WakeSchedule

Source

pub fn channel_timeouts_wake(&self) -> WakeSchedule

Source

pub fn held_announce_release_wake(&self) -> WakeSchedule

Source

pub fn route_expiry_wake( &self, interfaces: AttachedInterfaces<'_>, ) -> WakeSchedule

Source

pub fn blackhole_expiry_wake(&self) -> WakeSchedule

Source

pub fn destination_identity_expiry_wake(&self) -> WakeSchedule

Source

pub fn wake_schedules( &self, interfaces: AttachedInterfaces<'_>, ) -> WakeSchedules

Recomputes every schedule from live engine state. The manifold never calls this on the hot path; each engine mutation returns a WakeSchedules delta that the manifold merges into a cached copy instead. This full re-derive is the ground truth for those deltas: debug builds assert the merged cache matches it after every merge, so a mutation that moves a deadline without reporting it in its delta surfaces as a loud divergence instead of a silently missed wake.

Source

pub fn next_wake( &self, now: InstantMillis, interfaces: AttachedInterfaces<'_>, ) -> NextWake

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn attach_metrics_interface( &mut self, interface: InterfaceId, logical_interface: InterfaceId, )

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn write_commanded_announce( &mut self, commanded: &AnnounceNow, now: InstantMillis, fill_entropy: &mut impl FnMut(&mut [u8]), buf: &mut [u8], ) -> CommandedAnnounceWriteOutcome

Source

pub fn write_path_response_for_upstream( &mut self, destination: &DestinationHash, now: InstantMillis, fill_entropy: &mut impl FnMut(&mut [u8]), buf: &mut [u8], ) -> PathResponseWriteOutcome

Answer a path request for one of our own upstream destinations; RNS 1.4.2 Destination.announce(path_response=True). Path responses for foreign tracked destinations re-emit the retained announce instead, over in the scheduled-announce lane.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_send_group( &self, id: CommandId, send: SendGroup, ) -> CommandOutcome

Source

pub fn write_commanded_send_group( &self, send: &SendGroup, entropy: SendGroupEntropy, buf: &mut [u8], ) -> Result<usize, SendGroupWriteError>

Intentional deviation from RNS 1.4.2 Transport.outbound, which excludes only PLAIN sends from its receipt gate: a GROUP destination carries no identity to prove with, so the reference’s GROUP receipt can only ever time out, and we track none.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn write_commanded_send_single_packet( &mut self, id: CommandId, send: &SendSinglePacket, now: InstantMillis, entropy: SendSinglePacketEntropy, buf: &mut [u8], ) -> SendSinglePacketWriteOutcome

Seals to the peer’s announced ratchet, identity key when it never announced one (RNS 1.4.2 Destination.encrypt).

Source

pub fn prepare_send_single_packet_deferred( &self, id: CommandId, send: SendSinglePacket, now: InstantMillis, entropy: SendSinglePacketEntropy, ) -> SendSinglePacketPrepared

&self and side-effect-free: nothing is tracked until the scalars are back, so an abandoned obligation leaves no orphan receipt.

Source

pub fn finish_send_single_packet_deferred( &mut self, owed: EncryptOwed, ephemeral_public: X25519PublicKey, shared: X25519SharedSecret, buf: &mut [u8], ) -> FinishSendSinglePacketOutcome

The same bytes and row the inline path produces; the only difference is where the X25519 ran.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_send_to_channel( &self, id: CommandId, send: SendToChannel, ) -> CommandOutcome

Source

pub fn write_commanded_send_to_channel( &mut self, id: CommandId, send: &SendToChannel, now: InstantMillis, iv: &[u8; 16], buf: &mut [u8], ) -> Result<SendToChannelDispatch, SendToChannelWriteError>

The receiver delivers in sequence order, so a sequence number burned on a failed write would be a hole the peer stalls on forever. So the number is consumed only once the send is Tracked, after every fallible step.

Source

pub fn settle_channel_ack( &mut self, link_id: &LinkId, payload: &[u8], proof: DeliveryProof, arrived_at: InstantMillis, ) -> Option<(CommandId, PacketReceiptDelivered)>

RNS 1.4.2 PacketReceipt.validate_proof: the outstanding-hash match gates the ed25519 verify. The reference uses the same order, so proofs naming nothing we sent cost no signature check.

Source

pub fn fire_due_channel_timeouts<F>( &mut self, now: InstantMillis, interfaces: AttachedInterfaces<'_>, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

RNS 1.4.2 Channel._packet_timeout. Retransmits are byte-identical (same sequence and IV, so the same packet hash, so the original outstanding entry still settles). A send that exhausts CHANNEL_MAX_TRIES tears the link down.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

RNS 1.4.2 Packet(link, data).send().

Seal send’s payload under the link’s session key, bounded by the link’s negotiated MDU, framed directly into buf and owed to the interface the link rides.

The send is tracked as an outstanding receipt: it settles when the responder’s proof validates, or times out at the link’s traffic deadline (max(rtt × 6, 5 ms)).

Source§

impl<S> EngineState<S>
where S: StorageLayout,

RNS 1.4.2 Link.__init__, which always signals the default MTU and mode.

RNS 1.4.2 Link.validate_request, echoing the negotiated MTU and mode.

The crypto-pool-friendly twin of Self::write_owed_link_proof; same bytes either way.

RNS 1.4.2 Link.validate_proof

The crypto-pool-friendly twin of Self::write_owed_link_rtt; same bytes either way.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_identify( &self, id: CommandId, identify: Identify, ) -> CommandOutcome

Source

pub fn write_commanded_identify( &self, identify: &Identify, iv: &[u8; 16], buf: &mut [u8], ) -> Result<IdentifyDispatch, IdentifyWriteError>

RNS 1.4.2 Link.identify verbatim: signed_data = link_id ‖ keys, payload keys ‖ signature, sealed, context LINKIDENTIFY.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Seal the LINKCLOSE the way RNS 1.4.2 Link.teardown does (the link_id encrypted under the session key) then forget the link; the dropped row zeroizes its key material.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_send_request( &self, id: CommandId, request: SendRequest, ) -> CommandOutcome

Source

pub fn ingest_respond(&self, id: CommandId, respond: Respond) -> CommandOutcome

Source

pub fn response_fits_packet(&self, link_id: &LinkId, data: &[u8]) -> bool

Source

pub fn response_data_len_fits_packet( &self, link_id: &LinkId, data_len: usize, ) -> bool

Source

pub fn request_fits_packet(&self, link_id: &LinkId, data: &[u8]) -> bool

Source

pub fn write_commanded_send_request( &mut self, id: CommandId, request: &SendRequest, now: InstantMillis, iv: &[u8; 16], buf: &mut [u8], ) -> Result<SendRequestDispatch, LinkRequestWriteError>

Source

pub fn write_commanded_respond( &self, respond: &Respond, iv: &[u8; 16], buf: &mut [u8], ) -> Result<RespondDispatch, LinkRequestWriteError>

Fire-and-forget; the reference sends its response packet and moves on.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn provide_decompressed( &mut self, link_id: LinkId, hash: ResourceHash, plaintext: &[u8], now: InstantMillis, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

Verified exactly like an uncompressed assembly. The host signals its own inflate failure with an empty slice. A borrow-taking entry point beside the command queue (so a mebibyte never rides an enum).

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn owed_open_span(&self) -> Option<(LinkId, ResourceHash)>

The next incoming row whose parked open trails its frontier — one chew is dispatchable per row at a time (the spans chain through the state), and a row already Chewing waits for its verdict.

Source

pub fn open_span_job_view( &self, link_id: &LinkId, hash: &ResourceHash, ) -> Option<OpenSpanJobView<'_>>

The owed chew’s worker inputs, borrowed for the runtime to copy into a pool job; begin_open_chew then moves the state out to ride with them.

Source

pub fn begin_open_chew( &mut self, link_id: &LinkId, hash: &ResourceHash, ) -> Option<StreamedOpen>

Move the parked state out for the worker, leaving the dispatched span behind as the verdict’s identity check.

Source

pub fn apply_opened_span( &mut self, verdict: OffloadedOpenSpan<'_>, now: InstantMillis, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules

A worker’s span verdict, landing only on the row still marked with exactly this span — one for a row that died or was replaced mid-chew drops silently. The impossible near-miss (a replacement row that dispatched the identical span within one pool round trip) still cannot deliver wrong bytes: the returned state’s MAC midstate would refuse the mismatched transfer at its conclusion.

A transfer that finished arriving while the worker chewed parked as AwaitingOpen; its verdict concludes it here, chewing any small remainder inline — the proof is gated on it and the engine thread has nothing else to run first.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn fire_due_resource_deadlines<F>( &mut self, now: InstantMillis, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn ingest_send_resource_into<F>( &mut self, send: &ResourceSend<'_>, now: InstantMillis, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

Source

pub fn ingest_send_static_response_into<F>( &mut self, id: CommandId, respond: &Respond, now: InstantMillis, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

Source

pub fn ingest_send_resource_segment_into<F>( &mut self, send: &ResourceSend<'_>, segment: ResourceSegment, now: InstantMillis, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), ) -> WakeSchedules
where F: FnMut(&mut [u8]),

Segment 1 of a split records its hash as the chain’s original_hash; every later segment re-advertises it, so the host threads no hashes of its own.

total_data_bytes is the whole transfer’s uncompressed DATA length. The engine adds the metadata block on top, and RNS 1.4.2 advertises the sum (the d field) on every segment, never the segment’s own size.

A continuation whose live segment failed on the wire before this command reached the engine settles PredecessorFailed without advertising. A pipelining host therefore cannot revive a dead transfer’s tail.

The link whose staged continuation owes its deferred seal: the segment ahead of it has served every part and awaits only the proof, so the receiver is busy verifying and this is the window the seal was deferred into. The manifold drains this only after yielding because it shares its thread with the interface writers. The served parts must flush to the wire ahead of a multi-millisecond seal.

Source

pub fn seal_staged_continuation<F>( &mut self, link_id: &LinkId, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), )
where F: FnMut(&mut [u8]),

The deferred seal, run the moment the live segment’s last part is served: the receiver spends the next stretch ingesting and verifying, so the continuation’s seal rides that window instead of sitting on the advertise path.

Source

pub fn staged_seal_job_view( &self, link_id: &LinkId, ) -> Option<StagedSealJobView<'_>>

The owed seal’s worker inputs, borrowed for the manifold to copy into a crypto-pool job; mark_staged_sealing then parks the row until the verdict.

Source

pub fn mark_staged_sealing(&mut self, link_id: &LinkId)

Source

pub fn apply_offloaded_staged_seal( &mut self, verdict: OffloadedStagedSeal<'_>, sink: &mut impl FnMut(EngineReaction<'_>), )

A pool worker’s seal verdict lands on the row only if it still matches the job’s stream nonce and length; a row that died or was replaced meanwhile drops the verdict silently.

Source

pub fn promote_staged_resource<F>( &mut self, link_id: &LinkId, now: InstantMillis, fill_entropy: &mut F, sink: &mut impl FnMut(EngineReaction<'_>), )
where F: FnMut(&mut [u8]),

The staged continuation’s advertisement, owed since its build and released by the live segment’s proof. Runs in the same inbound pass as the proof settle, so the receiver sees the next advertisement exactly where the reference’s sender would first build it.

Source§

impl<S> EngineState<S>
where S: StorageLayout,

Source

pub fn write_commanded_path_request( &mut self, id: CommandId, request: &RequestPath, now: InstantMillis, buf: &mut [u8], ) -> PathRequestWriteOutcome

RNS 1.4.2 Transport.request_path emits unconditionally: an existing route never blocks the request, so a suspect path stays refreshable.

Source

pub fn pop_settled_path_request( &mut self, destination: &DestinationHash, ) -> Option<SettledPathRequest>

Source

pub fn pop_timed_out_path_request( &mut self, now: InstantMillis, ) -> Option<ExpiredPathRequest>

Drain one pending request whose timeout has passed. Call repeatedly until None to fully drain. Every pop is that command’s timeout settlement.

Trait Implementations§

Source§

impl<S> Debug for EngineState<S>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S> Default for EngineState<S>
where S: StorageLayout,

Source§

fn default() -> EngineState<S>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: Freeze, <S as StorageLayout>::PacketHashes: Freeze, <S as StorageLayout>::Channels: Freeze, <S as StorageLayout>::DirtyInterfaces: Freeze, <S as StorageLayout>::Routes: Freeze, <S as StorageLayout>::RouteExpiries: Freeze, <S as StorageLayout>::Announces: Freeze, <S as StorageLayout>::History: Freeze, <S as StorageLayout>::AppData: Freeze, <S as StorageLayout>::DestinationIdentities: Freeze, <S as StorageLayout>::DestinationIdentityAppData: Freeze, <S as StorageLayout>::UpstreamAppDestinations: Freeze, <S as StorageLayout>::Blackholes: Freeze, <S as StorageLayout>::HeldIdentities: Freeze, <S as StorageLayout>::SelfRatchets: Freeze, <S as StorageLayout>::Receipts: Freeze, <S as StorageLayout>::ReverseRoutes: Freeze, <S as StorageLayout>::PendingPathRequests: Freeze, <S as StorageLayout>::RecentPathRequests: Freeze, <S as StorageLayout>::SeenPathRequests: Freeze, <S as StorageLayout>::Tunnels: Freeze, <S as StorageLayout>::RecursivePathRequests: Freeze, <S as StorageLayout>::InterfacePathRequestLimits: Freeze, <S as StorageLayout>::InterfaceAnnounceLimits: Freeze, <S as StorageLayout>::HeldAnnounces: Freeze, <S as StorageLayout>::HeldAnnounceAppData: Freeze, <S as StorageLayout>::DestinationAnnounceLimits: Freeze, <S as StorageLayout>::GroupKeys: Freeze, <S as StorageLayout>::RequestHandlers: Freeze, <S as StorageLayout>::TransportedLinks: Freeze, <S as StorageLayout>::Links: Freeze, <S as StorageLayout>::OutgoingResources: Freeze, <S as StorageLayout>::IncomingResources: Freeze, <S as StorageLayout>::IncomingAssemblies: Freeze, <S as StorageLayout>::OutgoingAssemblies: Freeze, <S as StorageLayout>::DepartedInterfaces: Freeze,

§

impl<S> RefUnwindSafe for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: RefUnwindSafe, <S as StorageLayout>::PacketHashes: RefUnwindSafe, <S as StorageLayout>::Channels: RefUnwindSafe, <S as StorageLayout>::DirtyInterfaces: RefUnwindSafe, <S as StorageLayout>::Routes: RefUnwindSafe, <S as StorageLayout>::RouteExpiries: RefUnwindSafe, <S as StorageLayout>::Announces: RefUnwindSafe, <S as StorageLayout>::History: RefUnwindSafe, <S as StorageLayout>::AppData: RefUnwindSafe, <S as StorageLayout>::DestinationIdentities: RefUnwindSafe, <S as StorageLayout>::DestinationIdentityAppData: RefUnwindSafe, <S as StorageLayout>::UpstreamAppDestinations: RefUnwindSafe, <S as StorageLayout>::Blackholes: RefUnwindSafe, <S as StorageLayout>::HeldIdentities: RefUnwindSafe, <S as StorageLayout>::SelfRatchets: RefUnwindSafe, <S as StorageLayout>::Receipts: RefUnwindSafe, <S as StorageLayout>::ReverseRoutes: RefUnwindSafe, <S as StorageLayout>::PendingPathRequests: RefUnwindSafe, <S as StorageLayout>::RecentPathRequests: RefUnwindSafe, <S as StorageLayout>::SeenPathRequests: RefUnwindSafe, <S as StorageLayout>::Tunnels: RefUnwindSafe, <S as StorageLayout>::RecursivePathRequests: RefUnwindSafe, <S as StorageLayout>::InterfacePathRequestLimits: RefUnwindSafe, <S as StorageLayout>::InterfaceAnnounceLimits: RefUnwindSafe, <S as StorageLayout>::HeldAnnounces: RefUnwindSafe, <S as StorageLayout>::HeldAnnounceAppData: RefUnwindSafe, <S as StorageLayout>::DestinationAnnounceLimits: RefUnwindSafe, <S as StorageLayout>::GroupKeys: RefUnwindSafe, <S as StorageLayout>::RequestHandlers: RefUnwindSafe, <S as StorageLayout>::TransportedLinks: RefUnwindSafe, <S as StorageLayout>::Links: RefUnwindSafe, <S as StorageLayout>::OutgoingResources: RefUnwindSafe, <S as StorageLayout>::IncomingResources: RefUnwindSafe, <S as StorageLayout>::IncomingAssemblies: RefUnwindSafe, <S as StorageLayout>::OutgoingAssemblies: RefUnwindSafe, <S as StorageLayout>::DepartedInterfaces: RefUnwindSafe,

§

impl<S> Send for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: Send, <S as StorageLayout>::PacketHashes: Send, <S as StorageLayout>::Channels: Send, <S as StorageLayout>::DirtyInterfaces: Send, <S as StorageLayout>::Routes: Send, <S as StorageLayout>::RouteExpiries: Send, <S as StorageLayout>::Announces: Send, <S as StorageLayout>::History: Send, <S as StorageLayout>::AppData: Send, <S as StorageLayout>::DestinationIdentities: Send, <S as StorageLayout>::DestinationIdentityAppData: Send, <S as StorageLayout>::UpstreamAppDestinations: Send, <S as StorageLayout>::Blackholes: Send, <S as StorageLayout>::HeldIdentities: Send, <S as StorageLayout>::SelfRatchets: Send, <S as StorageLayout>::Receipts: Send, <S as StorageLayout>::ReverseRoutes: Send, <S as StorageLayout>::PendingPathRequests: Send, <S as StorageLayout>::RecentPathRequests: Send, <S as StorageLayout>::SeenPathRequests: Send, <S as StorageLayout>::Tunnels: Send, <S as StorageLayout>::RecursivePathRequests: Send, <S as StorageLayout>::InterfacePathRequestLimits: Send, <S as StorageLayout>::InterfaceAnnounceLimits: Send, <S as StorageLayout>::HeldAnnounces: Send, <S as StorageLayout>::HeldAnnounceAppData: Send, <S as StorageLayout>::DestinationAnnounceLimits: Send, <S as StorageLayout>::GroupKeys: Send, <S as StorageLayout>::RequestHandlers: Send, <S as StorageLayout>::TransportedLinks: Send, <S as StorageLayout>::Links: Send, <S as StorageLayout>::OutgoingResources: Send, <S as StorageLayout>::IncomingResources: Send, <S as StorageLayout>::IncomingAssemblies: Send, <S as StorageLayout>::OutgoingAssemblies: Send, <S as StorageLayout>::DepartedInterfaces: Send,

§

impl<S> Sync for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: Sync, <S as StorageLayout>::PacketHashes: Sync, <S as StorageLayout>::Channels: Sync, <S as StorageLayout>::DirtyInterfaces: Sync, <S as StorageLayout>::Routes: Sync, <S as StorageLayout>::RouteExpiries: Sync, <S as StorageLayout>::Announces: Sync, <S as StorageLayout>::History: Sync, <S as StorageLayout>::AppData: Sync, <S as StorageLayout>::DestinationIdentities: Sync, <S as StorageLayout>::DestinationIdentityAppData: Sync, <S as StorageLayout>::UpstreamAppDestinations: Sync, <S as StorageLayout>::Blackholes: Sync, <S as StorageLayout>::HeldIdentities: Sync, <S as StorageLayout>::SelfRatchets: Sync, <S as StorageLayout>::Receipts: Sync, <S as StorageLayout>::ReverseRoutes: Sync, <S as StorageLayout>::PendingPathRequests: Sync, <S as StorageLayout>::RecentPathRequests: Sync, <S as StorageLayout>::SeenPathRequests: Sync, <S as StorageLayout>::Tunnels: Sync, <S as StorageLayout>::RecursivePathRequests: Sync, <S as StorageLayout>::InterfacePathRequestLimits: Sync, <S as StorageLayout>::InterfaceAnnounceLimits: Sync, <S as StorageLayout>::HeldAnnounces: Sync, <S as StorageLayout>::HeldAnnounceAppData: Sync, <S as StorageLayout>::DestinationAnnounceLimits: Sync, <S as StorageLayout>::GroupKeys: Sync, <S as StorageLayout>::RequestHandlers: Sync, <S as StorageLayout>::TransportedLinks: Sync, <S as StorageLayout>::Links: Sync, <S as StorageLayout>::OutgoingResources: Sync, <S as StorageLayout>::IncomingResources: Sync, <S as StorageLayout>::IncomingAssemblies: Sync, <S as StorageLayout>::OutgoingAssemblies: Sync, <S as StorageLayout>::DepartedInterfaces: Sync,

§

impl<S> Unpin for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: Unpin, <S as StorageLayout>::PacketHashes: Unpin, <S as StorageLayout>::Channels: Unpin, <S as StorageLayout>::DirtyInterfaces: Unpin, <S as StorageLayout>::Routes: Unpin, <S as StorageLayout>::RouteExpiries: Unpin, <S as StorageLayout>::Announces: Unpin, <S as StorageLayout>::History: Unpin, <S as StorageLayout>::AppData: Unpin, <S as StorageLayout>::DestinationIdentities: Unpin, <S as StorageLayout>::DestinationIdentityAppData: Unpin, <S as StorageLayout>::UpstreamAppDestinations: Unpin, <S as StorageLayout>::Blackholes: Unpin, <S as StorageLayout>::HeldIdentities: Unpin, <S as StorageLayout>::SelfRatchets: Unpin, <S as StorageLayout>::Receipts: Unpin, <S as StorageLayout>::ReverseRoutes: Unpin, <S as StorageLayout>::PendingPathRequests: Unpin, <S as StorageLayout>::RecentPathRequests: Unpin, <S as StorageLayout>::SeenPathRequests: Unpin, <S as StorageLayout>::Tunnels: Unpin, <S as StorageLayout>::RecursivePathRequests: Unpin, <S as StorageLayout>::InterfacePathRequestLimits: Unpin, <S as StorageLayout>::InterfaceAnnounceLimits: Unpin, <S as StorageLayout>::HeldAnnounces: Unpin, <S as StorageLayout>::HeldAnnounceAppData: Unpin, <S as StorageLayout>::DestinationAnnounceLimits: Unpin, <S as StorageLayout>::GroupKeys: Unpin, <S as StorageLayout>::RequestHandlers: Unpin, <S as StorageLayout>::TransportedLinks: Unpin, <S as StorageLayout>::Links: Unpin, <S as StorageLayout>::OutgoingResources: Unpin, <S as StorageLayout>::IncomingResources: Unpin, <S as StorageLayout>::IncomingAssemblies: Unpin, <S as StorageLayout>::OutgoingAssemblies: Unpin, <S as StorageLayout>::DepartedInterfaces: Unpin,

§

impl<S> UnsafeUnpin for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: UnsafeUnpin, <S as StorageLayout>::PacketHashes: UnsafeUnpin, <S as StorageLayout>::Channels: UnsafeUnpin, <S as StorageLayout>::DirtyInterfaces: UnsafeUnpin, <S as StorageLayout>::Routes: UnsafeUnpin, <S as StorageLayout>::RouteExpiries: UnsafeUnpin, <S as StorageLayout>::Announces: UnsafeUnpin, <S as StorageLayout>::History: UnsafeUnpin, <S as StorageLayout>::AppData: UnsafeUnpin, <S as StorageLayout>::DestinationIdentities: UnsafeUnpin, <S as StorageLayout>::DestinationIdentityAppData: UnsafeUnpin, <S as StorageLayout>::UpstreamAppDestinations: UnsafeUnpin, <S as StorageLayout>::Blackholes: UnsafeUnpin, <S as StorageLayout>::HeldIdentities: UnsafeUnpin, <S as StorageLayout>::SelfRatchets: UnsafeUnpin, <S as StorageLayout>::Receipts: UnsafeUnpin, <S as StorageLayout>::ReverseRoutes: UnsafeUnpin, <S as StorageLayout>::PendingPathRequests: UnsafeUnpin, <S as StorageLayout>::RecentPathRequests: UnsafeUnpin, <S as StorageLayout>::SeenPathRequests: UnsafeUnpin, <S as StorageLayout>::Tunnels: UnsafeUnpin, <S as StorageLayout>::RecursivePathRequests: UnsafeUnpin, <S as StorageLayout>::InterfacePathRequestLimits: UnsafeUnpin, <S as StorageLayout>::InterfaceAnnounceLimits: UnsafeUnpin, <S as StorageLayout>::HeldAnnounces: UnsafeUnpin, <S as StorageLayout>::HeldAnnounceAppData: UnsafeUnpin, <S as StorageLayout>::DestinationAnnounceLimits: UnsafeUnpin, <S as StorageLayout>::GroupKeys: UnsafeUnpin, <S as StorageLayout>::RequestHandlers: UnsafeUnpin, <S as StorageLayout>::TransportedLinks: UnsafeUnpin, <S as StorageLayout>::Links: UnsafeUnpin, <S as StorageLayout>::OutgoingResources: UnsafeUnpin, <S as StorageLayout>::IncomingResources: UnsafeUnpin, <S as StorageLayout>::IncomingAssemblies: UnsafeUnpin, <S as StorageLayout>::OutgoingAssemblies: UnsafeUnpin, <S as StorageLayout>::DepartedInterfaces: UnsafeUnpin,

§

impl<S> UnwindSafe for EngineState<S>
where <S as StorageLayout>::ScheduledAnnounces: UnwindSafe, <S as StorageLayout>::PacketHashes: UnwindSafe, <S as StorageLayout>::Channels: UnwindSafe, <S as StorageLayout>::DirtyInterfaces: UnwindSafe, <S as StorageLayout>::Routes: UnwindSafe, <S as StorageLayout>::RouteExpiries: UnwindSafe, <S as StorageLayout>::Announces: UnwindSafe, <S as StorageLayout>::History: UnwindSafe, <S as StorageLayout>::AppData: UnwindSafe, <S as StorageLayout>::DestinationIdentities: UnwindSafe, <S as StorageLayout>::DestinationIdentityAppData: UnwindSafe, <S as StorageLayout>::UpstreamAppDestinations: UnwindSafe, <S as StorageLayout>::Blackholes: UnwindSafe, <S as StorageLayout>::HeldIdentities: UnwindSafe, <S as StorageLayout>::SelfRatchets: UnwindSafe, <S as StorageLayout>::Receipts: UnwindSafe, <S as StorageLayout>::ReverseRoutes: UnwindSafe, <S as StorageLayout>::PendingPathRequests: UnwindSafe, <S as StorageLayout>::RecentPathRequests: UnwindSafe, <S as StorageLayout>::SeenPathRequests: UnwindSafe, <S as StorageLayout>::Tunnels: UnwindSafe, <S as StorageLayout>::RecursivePathRequests: UnwindSafe, <S as StorageLayout>::InterfacePathRequestLimits: UnwindSafe, <S as StorageLayout>::InterfaceAnnounceLimits: UnwindSafe, <S as StorageLayout>::HeldAnnounces: UnwindSafe, <S as StorageLayout>::HeldAnnounceAppData: UnwindSafe, <S as StorageLayout>::DestinationAnnounceLimits: UnwindSafe, <S as StorageLayout>::GroupKeys: UnwindSafe, <S as StorageLayout>::RequestHandlers: UnwindSafe, <S as StorageLayout>::TransportedLinks: UnwindSafe, <S as StorageLayout>::Links: UnwindSafe, <S as StorageLayout>::OutgoingResources: UnwindSafe, <S as StorageLayout>::IncomingResources: UnwindSafe, <S as StorageLayout>::IncomingAssemblies: UnwindSafe, <S as StorageLayout>::OutgoingAssemblies: UnwindSafe, <S as StorageLayout>::DepartedInterfaces: UnwindSafe,

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