Skip to main content

Module transfer

Module transfer 

Source
Expand description

What moves over the wire, and how it is applied.

The transfer payload is a delta-scoped backup artifact — backup artifacts are explicitly “constructed from a list of assets, albums, and so on,” so a delta-scoped one needs no special construction path (build_delta_artifact). It is fetched with ranged GET (pull_artifact over the shared RangedFetcher), which makes the transfer resumable across the flaky-by-nature LAN and idempotent — content-addressing turns a re-fetch of an already-held blob into a no-op.

A received artifact is ingested through the backup restore path (ingest) — peering adds no separate deserialization. Restore re-verifies every ciphertext hash, checks STREAM tags on decrypt, and runs each manifest through verify_asset. Peering adds on top:

  • Chain-aware forward-vs-stale reconciliation. A peer pull cannot resurrect an asset the local device has already superseded — even if the artifact was honestly produced from an older state of the sender. Such an asset is quarantined, never silently applied.
  • No resurrection. An asset the device holds a tombstone for (kept past purge) is refused.
  • All-or-nothing per asset. Each asset restores on its own: one that fails to decrypt, or arrives without the metadata its manifest commits to, is not applied, and does not stop the rest.

The artifact is sealed under the session’s ArtifactSecret, derived from the channel’s TLS exporter — never a user passphrase.

Over a verified peering channel the ranged pull runs through ChannelBlobSource (pull_over_channel): the same fetch engine, the same content-address check, and a pull severed with the channel resumes on the next channel after the bytes it already holds.

Structs§

ArtifactBlobSource
An in-memory BlobSource that serves an artifact’s bytes over Range requests — the deterministic stand-in for the peering channel’s ranged GET. It records every served range (so a test can prove zero duplicate bytes on resume) and can inject a single mid-transfer LAN drop (a short read) to exercise the resume path.
ChannelBlobSource
A BlobSource over a verified peering channel (PeerClient), resuming after held: the bytes of the artifact this device already holds from an earlier, severed pull. A range inside held is answered locally; only the bytes after it cross the channel, so a resumed pull re-fetches nothing it already holds. Every byte that arrives is appended to held, so a pull severed again keeps what it got.
DeltaExport
Everything needed to assemble a delta-scoped artifact on the sending device.
LocalLibrary
The receiving device’s state an ingest reconciles against.
PeerRestore
The outcome of ingesting a peered artifact: every asset the artifact carried lands in exactly one bucket.

Functions§

artifact_address
The content address (SHA-256 hex) of an assembled artifact, for the ranged-GET integrity check. Byte-identical to the media server’s /blob/{hash} addressing.
build_delta_artifact
Build a delta-scoped backup artifact: include exactly the sender’s assets whose content address is in delta, then export through the ordinary backup path. Assets the receiver already holds are never in delta, so they never enter the artifact — the “only missing assets transfer” guarantee is structural, decided before a single byte is sealed.
ingest
Ingest a peered artifact through the backup restore path with chain-aware reconciliation.
pull_artifact
Pull an artifact over ranged GET, reusing the adverse-hardened RangedFetcher. Each request resumes from the current buffer length, so an interruption re-fetches zero bytes already held, and the reassembled bytes must hash to artifact_hash or the transfer fails — the same resumability and content-address verification the server download path relies on.
pull_over_channel
Pull the artifact address (len bytes) from the serving peer over client, through the same resumable, content-address-verified ranged fetch as pull_artifact.