Table of Contents

Extension seams (replication-aware backup)

This page documents Orleans.Lattice.Backup 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at extension-seams-replication-aware-backup.md, and llms.txt lists every page.

Part of Orleans.Lattice.Backup API reference.

These backup-package-local seams let the replication package layer replication awareness on top of the backup engine - an atomic multi-tree, multi-cluster restore, and a capture-side check that the sink is actually shared - without the backup package taking a dependency on replication. The dispatch, membership, and probe seams (IRestoreSagaDispatcher, IReplicatedTreeMembership, IBackupSinkSharingProbe) each have a default no-op registration installed by AddLatticeBackup, so a single-cluster host always takes the plain local restore path and never runs a cross-cluster probe; the replication package (or the host) supplies the real implementation. ILatticeCoordinatedRestoreEngine and ILatticeBackupSetResolver run the other way: AddLatticeBackup registers their real implementations (the restore engine itself, and a resolver that scans the catalog for set-stamped manifests), and the replication package consumes them.

IRestoreSagaDispatcher

The seam the restore path consults so a restore into a replicated tree can be promoted to an all-or-nothing coordinated restore across every cluster that replicates the target. The decision is a function of the target tree's current replication status, never of the backup's origin. RestoreAsync and RestoreSetAsync consult it only after they have authorized the restore, so the coordinated path never runs for a caller the restore gate refuses. The default registration never dispatches.

  • Task<LatticeRestoreResult?> TryDispatchAsync(LatticeRestoreRequest request, CancellationToken cancellationToken = default) - offers a single-tree restore to the coordinated path; returns the local cluster's result when the coordinated path handled it, or null to signal the caller should run the plain local restore. Throws ArgumentNullException when request is null.
  • Task<IReadOnlyList<LatticeRestoreResult>?> TryDispatchSetAsync(string setId, LatticeRestoreMode mode, CancellationToken cancellationToken = default) - offers a backup-set restore as one atomic unit over the union of the replicated members' peer sets; returns this cluster's per-member results, or null when no member is replicated (or the id is not a set id). Throws ArgumentException when setId is null or empty.

IReplicatedTreeMembership

The seam the startup sink guard consults to learn whether a tree participates in the cross-cluster replication set (a replicated tree must be backed by a shared external sink, not the default in-cluster sink). The default registration reports nothing replicated.

  • bool IsReplicated(string treeId) - reports whether the tree participates in the replication set. Throws ArgumentNullException when treeId is null.
  • IReadOnlyCollection<string> ReplicatedTrees { get; } - the ids of every replicated tree.

IBackupSinkSharingProbe

The capture-side analogue of IRestoreSagaDispatcher: the seam the startup sink guard and the periodic health monitor consult to learn whether the sink this cluster captures into is demonstrably the same store every peer cluster reads from. That is a deployment fact rather than a locally provable configuration property - two regions can hold identical-looking connection strings that resolve to different accounts - so the real (replication-supplied) implementation writes a tiny marker naming this cluster into its own sink and reads every peer's marker back out of that same sink. The default registration never probes and always reports NotApplicable.

  • BackupSinkSharingReport? LastReport { get; } - the most recent verdict, or null when the probe has never run. Read by the per-backup health path so annotating a report costs no I/O.
  • Task<BackupSinkSharingReport> ProbeAsync(CancellationToken cancellationToken = default) - runs the probe now and publishes the fresh verdict to LastReport. Inert (no sink or network I/O, verdict NotApplicable) when no tree is replicated or the deployment has no peers.

BackupSinkSharingReport

The outcome of one cross-cluster sharing probe. Serialized (alias olb.sh), immutable.

  • Constructor: BackupSinkSharingReport(BackupSinkSharingStatus status, string clusterId, int peerCount, IReadOnlyList<string> unconfirmedPeerClusterIds, DateTimeOffset probedAtUtc, string explanation). Throws ArgumentNullException (clusterId, unconfirmedPeerClusterIds, or explanation null) and ArgumentOutOfRangeException (peerCount negative).
  • BackupSinkSharingStatus Status - the verdict.
  • string ClusterId - the local cluster's id, as attested by the marker it wrote.
  • int PeerCount - the number of peer clusters considered.
  • IReadOnlyList<string> UnconfirmedPeerClusterIds - the peers whose marker could not be read back from this cluster's sink.
  • DateTimeOffset ProbedAtUtc - when the probe ran.
  • string Explanation - an operator-facing sentence naming the unconfirmed peers and the remediation.
  • bool IsRefuted - true only when Status is NotShared.

BackupSinkSharingStatus

Value Meaning
NotApplicable Nothing was measured: no replicated tree, no peers, no replication package, or the probe is disabled. The value a single-cluster deployment always reports.
Shared Every peer's marker was read back from this cluster's sink, so a coordinated restore can resolve the same backup fleet-wide.
Unverified At least one peer left no marker and was not reachable, so it may simply not be running yet. Undecided, not a fault.
NotShared At least one peer is reachable yet its marker is absent, so the sink is not shared and backups of a replicated tree are not restorable fleet-wide.

ILatticeCoordinatedRestoreEngine

Decomposes the atomic ShadowCutover restore into the separate phases a coordinated restore saga drives independently. The single ILatticeBackupRestoreService.RestoreAsync entry point composes these same phases for the local path, so both paths share one alias swap. Saga-unaware: it exposes the mechanism without any knowledge of the coordinator, write fence, or participant model.

  • Task<RestoreAdmissionReport> ProbeAdmissionAsync(LatticeRestoreRequest request, CancellationToken cancellationToken = default) - resolves the target's manifest, authorizes Restore over the effective restore scope (the same target-side check BuildShadowAsync makes), then walks the manifest chain and reports its size and topology without validating artifacts, fencing, or building, so an infeasible target is refused up front. Throws ArgumentNullException (request null), LatticeRestoreValidationException (the backup or a chain member is missing, or a requested sub-scope falls outside the captured scope), and LatticeAuthorizationDeniedException (unauthorized).
  • Task<LatticeRestoreResult> BuildShadowAsync(LatticeRestoreRequest request, CancellationToken cancellationToken = default) - builds the shadow tree from the manifest chain into a fresh physical tree without swapping the alias or fencing the live tree. Idempotent and resumable. Authorizes both trees exactly as RestoreAsync does. Registering the shadow takes the target tree's alias reservation, which a commit or a garbage-collect of the shadow releases. Throws ArgumentNullException (request null), ArgumentException (not a shadow-cutover request, or a reserved sys-backup-* target), LatticeRestoreValidationException (validation failure), LatticeAuthorizationDeniedException (unauthorized), and InvalidOperationException (the target tree is deleted, a delete of it is pending, or another alias change holds its reservation).
  • Task CommitShadowAsync(LatticeRestoreResult shadow, CancellationToken cancellationToken = default) - commits a built shadow by atomically swapping the registry alias, then refreshing routing and converging any covering tag index. The caller engages the write fence around this call. Idempotent. Authorizes Restore over the whole target tree. The physical tree ids carried on shadow are re-validated against registry provenance, so a result whose ShadowPhysicalTreeId or PreviousPhysicalTreeId names a tree that is neither the target, nor a shadow the engine built for that target, nor the target's current physical tree, nor the pre-restore copy the target's current, not-yet-final restore recorded at its cutover, is refused. Releases the target tree's alias reservation once the cutover completes. Throws ArgumentNullException (shadow null), ArgumentException (not a shadow-cutover build result), LatticeRestoreValidationException (a named physical tree does not belong to the target), LatticeAuthorizationDeniedException (unauthorized), InvalidOperationException (the target tree is deleted, a delete of it is pending, or a different alias change holds its reservation), and LatticeTreeOwnershipDeniedException (the registered tree ownership guard refuses the alias swap).
  • Task DeleteShadowAsync(string shadowPhysicalTreeId, CancellationToken cancellationToken = default) - reliably garbage-collects an orphaned shadow so an aborted restore leaks no storage. Idempotent: a tree that was never registered is a no-op. Because it purges every shard of the named tree, it deletes only a tree the engine itself stamped as a restore shadow, and authorizes Restore over the logical tree that shadow was built for - taken from the shadow's own registry provenance, never from the argument. It also releases the alias reservation the shadow build took on that logical tree, so an aborted restore does not go on refusing the tree's delete or later alias changes. Throws ArgumentException when shadowPhysicalTreeId is null or empty, LatticeRestoreValidationException when the named tree is registered but is not a restore shadow, and LatticeAuthorizationDeniedException (unauthorized).
  • string ResolveShadowTreeId(LatticeRestoreRequest request) - deterministically resolves the shadow tree id a build of request would produce, without I/O, so an aborting participant can garbage-collect by id after losing its in-memory state. Throws ArgumentNullException (request null) and ArgumentException (no explicit target tree).

ILatticeBackupSetResolver

The saga-unaware read seam that expands a captured backup-set id into the per-tree member backups it references, so the restore path can restore every tree in a set as one unit.

  • Task<IReadOnlyList<BackupSetMember>> ResolveMembersAsync(string setId, CancellationToken cancellationToken = default) - resolves the set's member backups in tree-id order (the default resolver answers a set a backup-set schedule retains from the membership the schedule recorded, because a member's own SetId stamp moves to a later set that captures the unchanged tree again), or an empty list when the id is not a set id (for example a single-tree backup id). Throws ArgumentException when setId is null or empty.

BackupSetMember

One resolved member of a captured backup set: the member backup id and the tree it restores. Returned by ILatticeBackupSetResolver. An in-process value only (no serializer surface).

  • string BackupId - the content-addressed id of the member backup.
  • string TreeId - the tree the member backup restores.