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, ornullto signal the caller should run the plain local restore. ThrowsArgumentNullExceptionwhenrequestis 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, ornullwhen no member is replicated (or the id is not a set id). ThrowsArgumentExceptionwhensetIdis 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. ThrowsArgumentNullExceptionwhentreeIdis 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, ornullwhen 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 toLastReport. Inert (no sink or network I/O, verdictNotApplicable) 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). ThrowsArgumentNullException(clusterId,unconfirmedPeerClusterIds, orexplanationnull) andArgumentOutOfRangeException(peerCountnegative). 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-trueonly whenStatusisNotShared.
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, authorizesRestoreover the effective restore scope (the same target-side checkBuildShadowAsyncmakes), 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. ThrowsArgumentNullException(requestnull),LatticeRestoreValidationException(the backup or a chain member is missing, or a requested sub-scope falls outside the captured scope), andLatticeAuthorizationDeniedException(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 asRestoreAsyncdoes. Registering the shadow takes the target tree's alias reservation, which a commit or a garbage-collect of the shadow releases. ThrowsArgumentNullException(requestnull),ArgumentException(not a shadow-cutover request, or a reservedsys-backup-*target),LatticeRestoreValidationException(validation failure),LatticeAuthorizationDeniedException(unauthorized), andInvalidOperationException(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. AuthorizesRestoreover the whole target tree. The physical tree ids carried onshadoware re-validated against registry provenance, so a result whoseShadowPhysicalTreeIdorPreviousPhysicalTreeIdnames 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. ThrowsArgumentNullException(shadownull),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), andLatticeTreeOwnershipDeniedException(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 authorizesRestoreover 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. ThrowsArgumentExceptionwhenshadowPhysicalTreeIdis null or empty,LatticeRestoreValidationExceptionwhen the named tree is registered but is not a restore shadow, andLatticeAuthorizationDeniedException(unauthorized).string ResolveShadowTreeId(LatticeRestoreRequest request)- deterministically resolves the shadow tree id a build ofrequestwould produce, without I/O, so an aborting participant can garbage-collect by id after losing its in-memory state. ThrowsArgumentNullException(requestnull) andArgumentException(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 ownSetIdstamp 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). ThrowsArgumentExceptionwhensetIdis 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.