Expand description
Transport-agnostic replication core for sapphire-framework workspaces.
See docs/superpowers/specs/2026-09-15-p2p-sync-iroh-design.md, section 2.
Modules§
- paths
- Workspace-relative paths.
Structs§
- Conflict
- Content
Hash - SHA-256 of a file’s bytes.
- Disk
State - What is on disk for a path.
- Dot
- One event: the
counter-th write recorded byreplica. - Entry
- One version of one path.
- Hlc
- Hybrid logical clock value, ordered by wall time and then the logical counter.
- Meta
- Replica-wide metadata.
- Parse
Hash Error - A string that is not 64 hex digits.
- Path
State - A path’s sibling versions, everything merged so far, and what is on disk.
- Path
Update - A path’s replicated state: its sibling versions and everything merged so far.
- Replica
- One workspace root and its replica store.
- Replica
Config - How a replica is set up.
- Replica
Id - Identity of one replica store, created once (UUIDv7). A reinstall gets a new one, so dots are never reused.
- Replica
Store - Persistent replica state.
- Report
- Effects of one
scan,applyorfetch_missingcall. - Skipped
- Sync
Filter - Declarative sync filter: the built-in rule for an app name plus
.sapphireignore. - System
Clock - The system wall clock.
- Version
Vector - For each replica, the highest counter covered.
Enums§
- Content
- What a version holds.
- Error
- Errors raised by the replication core.
- Pause
Reason - Why a replica refuses to scan or apply.
- Scan
Outcome - Skip
Reason - Why a path was not synced on this replica.
Constants§
- DEFAULT_
MAX_ FILE_ SIZE - Files larger than this are not synced unless configured otherwise.
- FORMAT_
VERSION - On-disk format of the replica store. Bump for any change in stored data or in merge behaviour (spec §5.4).
- IGNORE_
FILE - Name of the per-workspace ignore file.
- MAX_
DRIFT_ MS - How far ahead of the local wall clock a remote timestamp may pull the local clock.
Traits§
- Clock
- Source of wall-clock time, injectable for tests.
- Content
Source - Where a replica gets bytes it does not have: a peer, in practice.
Functions§
- conflict_
path <stem>.conflict-<grain-id>-<counter>.<ext>, or<name>.conflict-<grain-id>-<counter>when the name has no extension. A leading dot does not start an extension.- join
- DVV-set join of a local state with an incoming one. Returns the joined
(versions, seen), orNonewhen the local state already contains everything. - needs_
copy - Whether
loserneeds a conflict copy next towinner. - winner
- The sibling whose content belongs on disk.
Type Aliases§
- Result
- Result alias for the replication core.