Skip to main content

ingest

Function ingest 

Source
pub fn ingest(
    artifact_bytes: &[u8],
    secret: &ArtifactSecret,
    exporter_pub: &HybridVerifyingKey,
    local: LocalLibrary<'_>,
) -> Result<PeerRestore, PeeringError>
Expand description

Ingest a peered artifact through the backup restore path with chain-aware reconciliation.

For each asset the artifact carries, relative to local:

  • tombstoned locally → refused, whatever its chain says;
  • absent locally → applied (a new asset);
  • head identical → no-op;
  • head differs, artifact chain contains our head as an ancestor → a forward update, so we adopt it (applied);
  • head differs otherwise → the artifact is stale or divergent; quarantined, never applied, so a peer can never resurrect a locally-superseded asset.

Each asset to apply restores on its own through BackupArtifact::restore in Commit mode (which decrypts and re-verifies), so it applies whole or not at all: a restore failure, or a metadata blob that is missing or does not match the hash its manifest commits to, lands it in PeerRestore::incomplete without touching the others.