Skip to main content

weirdnet_sync/
lib.rs

1//! Linked-device sync: clocks, an op log, merge primitives, sealed pages, a roster and
2//! the `weirdnet-sync/v1` protocol over [`weirdnet-net`](weirdnet_net).
3//!
4//! Record types (bookmarks, notes, and so on) stay in the application. Persistence stays
5//! in the application too; [`OpLog`] is the in-memory log the app can snapshot.
6#![forbid(unsafe_code)]
7
8pub mod hlc;
9pub mod identity;
10pub mod jobs;
11pub mod lease;
12pub mod log;
13pub mod merge;
14pub mod net;
15pub mod plan;
16pub mod protocol;
17pub mod record;
18pub mod roster;
19pub mod rotation;
20pub mod seal;
21
22mod bytes;
23mod error;
24
25pub use error::{Result, SyncError};
26pub use hlc::{Hlc, NodeId};
27pub use identity::{FileSecrets, Identity, LinkSettings, SecretStore, Tick};
28pub use jobs::{JobEvent, JobRules, JobSpec, JobStatus, JobView, Jobs, MAX_JOB_CLAIM, job_lease};
29pub use lease::{
30    Elector, FenceGuard, LEASE_TYPE, LeaseConfig, LeaseError, LeaseHandle, LeaseLimits, LeaseName, LeaseRecord, LeaseState, Leases, Stale, Term,
31    Voter, Voters,
32};
33pub use log::{LogEntry, OpLog, Page as LogPage};
34pub use merge::{CONFLICT_KEEP_MS, Lww, OrSet, TOMBSTONE_GC_MS, can_gc_tombstone, edit_vs_delete, folder_cycle, lww};
35pub use net::{
36    LinkBundle, MergeOutcome, PullOutcome, PullTypesOutcome, SyncHandler, SyncState, node_config, pull_chunks, pull_from, pull_from_outcome,
37    pull_from_shared, pull_types, pull_types_shared, start_node,
38};
39pub use plan::Plan;
40pub use protocol::{
41    Ack, Cursors, Envelope, Hello, HelloOk, KeyRef, Message, PAGE_BUDGET, PAGE_MAX, PROTOCOL, Page, Pull, Refuse, RefuseReason, RosterMsg,
42    SYNC_PROFILE, decode, decode_framed, encode, encode_framed,
43};
44pub use record::{
45    Blob, Limits, RecordOptions, RecordRef, RecordValue, SealInfo, Value, chunk_type, open_record_scoped, scoped_record_aad, scoped_record_key,
46    seal_record_scoped,
47};
48pub use roster::{CallerCheck, DeviceClass, DeviceGrant, MAX_GRANT_ROLES, MAX_GRANT_TYPES, Roster, SessionCheck, SessionOffer};
49pub use rotation::{Admission, ChainView, Device, DeviceKey, EpochKeys, KeyChain, KeyStatus, Rotation, SealedKey, ValidRotation};
50pub use seal::{SyncKey, SyncType, open_page, page_aad, page_aad_keyed, rotated_sync_key, seal_page, sync_key, sync_key_info};