Skip to main content

Module net

Module net 

Source
Expand description

The pull protocol running on a weirdnet_net::Node (/weirdnet/sync/2).

The official WeirdBrains relay must not store pages; this module only exchanges sealed envelopes between the user’s own nodes.

Structs§

LinkBundle
What a service link carries for sync, besides the node’s certificate (which the link mints): the linking device’s roster, the node’s service DeviceGrant and, for a grant with sync types, the epoch keys (secret; zeroized on drop, never shown by Debug). The link channel is already authenticated and encrypted (SAS-checked), so the keys need no further sealing. Made by SyncState::service_bundle, taken by SyncState::new_service; weirdnet-device-link carries it as opaque bytes.
MergeOutcome
What SyncState::merge_back took from the snapshot.
PullOutcome
The result of a pull that may have applied pages before it failed.
PullTypesOutcome
The result of pull_types: one PullOutcome per type asked, in the order asked.
SyncHandler
Request-response handler that talks Envelope on SYNC_PROFILE.
SyncState
Mutable state a sync node answers from and applies pages into.

Functions§

node_config
Listen with the in-memory transport (tests) or the caller’s config, 256 KiB caps.
observe
Advance our clock past the newest op held, so the next local write orders after everything this node has seen (a visit after a remote clear, say).
pull_chunks
Pull the chunks of typ (for crate::Limits::eager_chunks off, or to retry): the same session as pull_from, for the companion type chunk_type(typ).
pull_from
Hello then pull every roster member the peer advertised, applying pages and acking.
pull_from_outcome
pull_from, reporting the entries applied even when the pull stops early (a later page refused, the network gone, a rotation failing).
pull_from_shared
Pull for a state shared with this node’s SyncHandler, without holding its lock across the network: snapshot, pull into the snapshot, then SyncState::merge_back (also after an error, so pages already applied are kept).
pull_types
Pull several record types from peer in one session: one Hello (and at most one roster swap) for all of them, then each type’s pages and acks, every envelope sealed under that type’s own key. Works with any /weirdnet/sync/2 peer (0.7 and 0.8.x answer each request on its own, so the wire does not change).
pull_types_shared
pull_types for a state shared with this node’s SyncHandler, without holding its lock across the network (as pull_from_shared does for one type).
start_node
Start a sync node on SYNC_PROFILE.