Skip to main content

Crate weirdnet_sync

Crate weirdnet_sync 

Source
Expand description

Linked-device sync: clocks, an op log, merge primitives, sealed pages, a roster and the weirdnet-sync/v1 protocol over weirdnet-net.

Record types (bookmarks, notes, and so on) stay in the application. Persistence stays in the application too; OpLog is the in-memory log the app can snapshot.

Re-exports§

pub use hlc::Hlc;
pub use hlc::NodeId;
pub use identity::FileSecrets;
pub use identity::Identity;
pub use identity::LinkSettings;
pub use identity::SecretStore;
pub use identity::Tick;
pub use jobs::JobEvent;
pub use jobs::JobRules;
pub use jobs::JobSpec;
pub use jobs::JobStatus;
pub use jobs::JobView;
pub use jobs::Jobs;
pub use jobs::MAX_JOB_CLAIM;
pub use jobs::job_lease;
pub use lease::Elector;
pub use lease::FenceGuard;
pub use lease::LeaseConfig;
pub use lease::LeaseError;
pub use lease::LeaseHandle;
pub use lease::LeaseLimits;
pub use lease::LeaseName;
pub use lease::LeaseRecord;
pub use lease::LeaseState;
pub use lease::Leases;
pub use lease::Stale;
pub use lease::Term;
pub use lease::Voter;
pub use lease::Voters;
pub use log::LogEntry;
pub use log::OpLog;
pub use log::Page as LogPage;
pub use merge::CONFLICT_KEEP_MS;
pub use merge::Lww;
pub use merge::OrSet;
pub use merge::TOMBSTONE_GC_MS;
pub use merge::can_gc_tombstone;
pub use merge::edit_vs_delete;
pub use merge::folder_cycle;
pub use merge::lww;
pub use net::LinkBundle;
pub use net::MergeOutcome;
pub use net::PullOutcome;
pub use net::SyncHandler;
pub use net::SyncState;
pub use net::node_config;
pub use net::pull_chunks;
pub use net::pull_from;
pub use net::pull_from_outcome;
pub use net::pull_from_shared;
pub use net::start_node;
pub use plan::Plan;
pub use protocol::Ack;
pub use protocol::Cursors;
pub use protocol::Envelope;
pub use protocol::Hello;
pub use protocol::HelloOk;
pub use protocol::KeyRef;
pub use protocol::Message;
pub use protocol::PAGE_BUDGET;
pub use protocol::PAGE_MAX;
pub use protocol::PROTOCOL;
pub use protocol::Page;
pub use protocol::Pull;
pub use protocol::Refuse;
pub use protocol::RefuseReason;
pub use protocol::RosterMsg;
pub use protocol::SYNC_PROFILE;
pub use protocol::decode;
pub use protocol::decode_framed;
pub use protocol::encode;
pub use protocol::encode_framed;
pub use record::Blob;
pub use record::Limits;
pub use record::RecordOptions;
pub use record::RecordRef;
pub use record::RecordValue;
pub use record::SealInfo;
pub use record::Value;
pub use record::chunk_type;
pub use roster::CallerCheck;
pub use roster::DeviceClass;
pub use roster::DeviceGrant;
pub use roster::MAX_GRANT_ROLES;
pub use roster::MAX_GRANT_TYPES;
pub use roster::Roster;
pub use roster::SessionCheck;
pub use roster::SessionOffer;
pub use rotation::Admission;
pub use rotation::ChainView;
pub use rotation::Device;
pub use rotation::DeviceKey;
pub use rotation::EpochKeys;
pub use rotation::KeyChain;
pub use rotation::KeyStatus;
pub use rotation::Rotation;
pub use rotation::SealedKey;
pub use rotation::ValidRotation;
pub use seal::SyncKey;
pub use seal::SyncType;
pub use seal::open_page;
pub use seal::page_aad;
pub use seal::page_aad_keyed;
pub use seal::rotated_sync_key;
pub use seal::seal_page;
pub use seal::sync_key;
pub use seal::sync_key_info;

Modules§

hlc
Hybrid logical clock: (physical_ms, counter, node_id).
identity
This device’s place in the user’s Weirdnet: the user identity, its own node key and certificate, and the linked-devices roster it shares with the user’s other devices (Morph, Ymir, Bragi, …), kept current by sync passes.
jobs
A job log (since 0.8): jobs posted to the op log, claimed under a per-job lease, with checkpoints, results and re-claims after a failure.
lease
Majority-vote leases with fencing terms (since 0.8).
log
Append-only per-node op log. A device never rewrites another node’s entries.
merge
Last-writer-wins registers, OR-sets, edit-vs-delete, tombstone GC and a folder-cycle check.
net
The pull protocol running on a weirdnet_net::Node (/weirdnet/sync/2).
plan
Plans (since 0.8): one signed, versioned document per name, written by a lease holder and ordered by (term, version), never by wall clock or HLC, so a stale holder whose clock runs ahead can’t override a newer holder’s plan.
protocol
weirdnet-sync/v1 messages and length-prefixed CBOR framing.
record
Record values larger than one page, and values sealed per record.
roster
Device roster: self-issued NodeCerts, revocations and the key epoch.
rotation
Real key rotation: random epoch keys sealed to each remaining device.
seal
SyncKey derivation and page sealing.

Enums§

SyncError

Type Aliases§

Result