Table of Contents

Services

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 services.md, and llms.txt lists every page.

Part of Orleans.Lattice.Backup API reference.

ILatticeBackupCaptureService

The full-capture engine.

  • Task<LatticeBackupCaptureResult> CaptureAsync(LatticeBackupCaptureRequest request, CancellationToken cancellationToken = default) - captures a full backup of the request's scope and returns its content-addressed id and manifest. Throws ArgumentNullException (request null), LatticeAuthorizationDeniedException (unauthorized), LatticeSnapshotReplayBudgetExceededException (scope exceeds the replay budget), LatticeSaturatedException (snapshot open shed under saturation), and LatticeCursorSnapshotExpiredException (pinned snapshot expired mid-capture). With a tenancy add-on active it also throws LatticeBackupTenantIsolationException (the tree is outside the caller's tenant) and LatticeTenantAccessDeniedException (the capture is not admitted under the calling tenant's request-rate budget).
  • Task<LatticeBackupSetCaptureResult> CaptureSetAsync(LatticeBackupSetCaptureRequest request, CancellationToken cancellationToken = default) - captures a backup set: one full backup per scope grouped under a single set manifest. When CrossTreeConsistent is set and the set spans more than one tree, every tree is captured inside a single causal fence, selected after in-flight cross-tree atomic sagas drain, so a cross-tree atomic write is never torn across the set (each tree is still captured by its own snapshot, one after another). When the set spans more than one tree, every member manifest is stamped with the set's SetId, name, and capture time (SetCreatedAtUtc) so the catalogued per-tree backups can be grouped back into one logical set entry, and the returned BackupSetManifest.SetId is that same id. A set of a single scope is deliberately left unstamped - it is indistinguishable from a plain backup and lists as one - so its returned SetId is null: the create response agrees with the catalog row, and there is no id that resolves to nothing. Restore such a backup with RestoreAsync(backupId), not RestoreSetAsync. Throws the same exceptions as CaptureAsync, plus LatticeBackupCrossTreeFenceException when a stable fence cannot be established within the configured attempts or drain timeout.

ILatticeBackupIncrementalCaptureService

The incremental-capture engine.

  • Task<LatticeBackupCaptureResult> CaptureIncrementalAsync(LatticeBackupIncrementalCaptureRequest request, CancellationToken cancellationToken = default) - captures an incremental backup layered on a base backup and records the base id as the manifest's BaseBackupId. The base manifest is read from the sink, and the increment inherits the base's scope (the request scope is advisory). When a sound delta cannot be produced - the base resume point was trimmed off the WAL, a range delete surfaced in the delta window, the base chain was captured on a different cluster, the base predates the recording of the atomic batches it held back as undecided, a committed atomic write's prepared writes precede the delta window, the saga decision gate was not held for the whole drain, or a retention pass began pruning the base while the delta drained (the increment's manifest is then withdrawn rather than published with no base) - it falls back to a fresh full capture and returns that result instead. Throws ArgumentNullException when request is null, KeyNotFoundException when the sink holds no manifest for BaseBackupId, and LatticeAuthorizationDeniedException when the caller is not authorized over the base's scope, plus the tenancy exceptions CaptureAsync documents. A fallback full capture can also throw the replay-budget, saturation, and snapshot-expiry exceptions CaptureAsync documents.

ILatticeBackupRestoreService

The causally-faithful restore engine.

  • Task<LatticeRestoreResult> RestoreAsync(LatticeRestoreRequest request, CancellationToken cancellationToken = default) - resolves the backup's manifest (catalog first, then the sink) and authorizes the restore; only then, when the target tree is replicated, is the request handed to the coordinated restore path through IRestoreSagaDispatcher, whose result it returns. Otherwise it walks the base chain, validates every artifact against its recorded digest, then applies the entries per LatticeRestoreRequest.Mode (in-place bulk-load / merge, or atomic shadow-cutover). Idempotent under retry. Authorization covers both trees the restore names: Restore over the target tree, and - only when TargetTreeId retargets the backup onto a different tree than the one captured - Backup over the source tree recorded in each chain manifest's own scope, at the range actually replayed. A same-tree restore is unaffected. Throws ArgumentNullException (request null), ArgumentException (the target is a reserved sys-backup-* tree), LatticeRestoreValidationException (pre-apply validation failure, including a backup absent from both the catalog and the sink, a broken chain, or a requested sub-scope outside the captured scope; for a replicated target, also a coordinated restore that was refused before it started or aborted), and LatticeAuthorizationDeniedException (unauthorized). With a tenancy add-on active it also throws LatticeBackupTenantIsolationException when the target tree, or a retargeted source tree, is outside the caller's tenant. A ShadowCutover restore also throws InvalidOperationException when the target tree is deleted, a delete of it is pending, or another alias change of it (a resize, a schema remediation, or a different restore or revert) holds its alias reservation, and LatticeTreeOwnershipDeniedException when the registered tree ownership guard refuses its alias swap; see Architecture.
  • Task<IReadOnlyList<LatticeRestoreResult>> RestoreSetAsync(string setId, CancellationToken cancellationToken = default) - expands a captured backup set into its member trees (a set a backup-set schedule captured resolves to the membership the schedule recorded; any other set by scanning the catalog for the manifests stamped with setId), authorizes Restore over every member tree before anything is dispatched, and restores each one via shadow-cutover, promoting to a single all-or-nothing coordinated saga when any member is replicated. A set naming one tree the caller may not restore is therefore refused whole with LatticeAuthorizationDeniedException (or, with a tenancy add-on active, LatticeBackupTenantIsolationException). Throws ArgumentException when setId is null or empty, or when it resolves to no member trees. That last failure distinguishes its two causes: an id that equals the set id a single catalogued backup would have been given (the content address of that one member id) names a single-tree set, which is captured as a plain backup and is never stamped as a set member, so the message names the exact backupId to pass to RestoreAsync instead; any other unresolved id is reported as absent from the catalog. A local per-member restore can also fail with the exceptions RestoreAsync documents for a ShadowCutover restore.
  • Task RevertRestoreAsync(LatticeRestoreResult restore, CancellationToken cancellationToken = default) - reverts a ShadowCutover restore by swapping the target tree's registry alias back to PreviousPhysicalTreeId. Idempotent. Authorization gates the logical target tree, so the physical tree ids on restore are separately re-validated against registry provenance: each must be the target itself, a shadow the engine built for that target, the target's current physical tree, or the pre-restore copy the target's current, not-yet-final restore recorded at its cutover. Throws ArgumentNullException (restore null), ArgumentException (not a shadow-cutover result), LatticeRestoreValidationException (a named physical tree does not belong to the target), and LatticeAuthorizationDeniedException (unauthorized). Also throws InvalidOperationException when an unrelated later physical copy superseded this restore (before taking its reservation or changing lineage), when the restore is final (a later restore of the tree committed, it was released, or LatticeBackupOptions.RestoreRevertRetention elapsed) or the copy it returns to has been retired, while the tree is deleted, a delete of it is pending, or another alias change holds its alias reservation, and LatticeTreeOwnershipDeniedException when the registered tree ownership guard refuses re-pointing the alias.
  • Task ReleaseRestoreAsync(LatticeRestoreResult restore, CancellationToken cancellationToken = default) - makes a ShadowCutover restore final: RevertRestoreAsync refuses it from then on, and the copy it would have reverted to is retired in the background and purged after LatticeOptions.SoftDeleteDuration. Idempotent. Authorizes Restore over the target tree and re-validates the result's physical tree ids against registry provenance, as a revert does. Throws ArgumentNullException (restore null), ArgumentException (not a shadow-cutover result), LatticeRestoreValidationException (a named physical tree does not belong to the target), LatticeAuthorizationDeniedException (unauthorized), and InvalidOperationException (the tree is deleted, or another alias change holds its alias reservation). See Retiring restore copies.
  • Task ReleaseRestoreSetAsync(IReadOnlyList<LatticeRestoreResult> restores, CancellationToken cancellationToken = default) - releases every member result of a set restore, authorizing every member before any is released. Throws as ReleaseRestoreAsync does, and ArgumentNullException when restores is null.
  • Task<LatticeRestoreCopyAudit> AuditRestoreCopiesAsync(string treeId, CancellationToken cancellationToken = default) - reports the copies the tree's shadow-cutover restores left behind: its alias target, the copy a revertible restore returns to, every copy no revert can reach, and any hold that keeps them. A read that changes nothing. Authorizes Restore over the tree. Throws ArgumentException (treeId null, empty, or a reserved sys-backup-* tree) and LatticeAuthorizationDeniedException (unauthorized).
  • Task<LatticeRestoreCopyAudit> RepairRestoreCopiesAsync(string treeId, CancellationToken cancellationToken = default) - as AuditRestoreCopiesAsync, and schedules the retirement of the copies it reports at once; retirement runs in the background, one copy per pass. Throws as AuditRestoreCopiesAsync does.
  • The four members above are default interface methods that throw NotSupportedException, so an existing implementation of the interface still compiles; the registered service implements them.

ILatticeBackupScheduler

The public entry point for on-demand triggers, schedule registration, and retention. Each operation targets a BackupScopeSelector and is coordinated per scope so triggers, scheduled captures, and retention for the same scope never overlap.

  • Task<string?> TriggerFullBackupAsync(BackupScopeSelector scope) - triggers a full backup; returns the backup id, or null when a capture for the scope is already in flight.
  • Task<string?> TriggerIncrementalBackupAsync(BackupScopeSelector scope) - triggers an incremental backup layered on the most recent backup for the scope (or a full baseline when none exists); returns the backup id, or null when skipped by the overlap guard.
  • Task ScheduleRecurringBackupAsync(LatticeBackupScheduleRequest request) - registers or updates a recurring backup of the request's scope that fires every Interval, capturing a full or incremental backup per the request. The interval is clamped up to the reminder minimum; a runtime schedule registered this way overrides the configured LatticeBackupScheduleOptions cadence for the chosen kind. Idempotent. Authorizes the caller's Backup capability over the scope at registration (the reminder-fired cycle later runs system-origin, because a reminder carries no caller). Throws ArgumentNullException when request is null and LatticeAuthorizationDeniedException when the caller is not authorized.
  • Task CancelScheduleAsync(BackupScopeSelector scope, bool incremental) - removes the scope's recurring schedule for one kind (incremental selects the incremental schedule, otherwise the full one): unregisters that kind's schedule reminder and clears any runtime interval override. Idempotent: a missing schedule is a no-op.
  • Task EnsureScheduleAsync(BackupScopeSelector scope) - registers or updates the recurring full and incremental schedule reminders for the scope per its LatticeBackupScheduleOptions: an enabled kind is (re-)registered at its configured cadence and a disabled kind's reminder is unregistered. It consults only the configured options, so running it after ScheduleRecurringBackupAsync replaces (or, for a kind disabled in options, removes) that kind's runtime schedule reminder; the runtime interval that call recorded is left in place, so BackupSchedulerRuntimeStatus keeps reporting it until CancelScheduleAsync clears it. Idempotent. Authorizes the caller's Backup capability over the scope and throws LatticeAuthorizationDeniedException when it is not granted.
  • Task<BackupRetentionReport> PruneAsync(BackupScopeSelector scope) - prunes the scope's backup chain per its retention policy, preserving the base chain of every retained increment; a no-op that retains everything when retention is disabled.

All five scope-typed methods throw ArgumentNullException when scope is null. Triggers, registration, cancellation and pruning require the caller's Backup capability over the scope at the scheduler grain, before any durable mutation or catalog read. Pruning is authorized even when retention is disabled. A missing schedule remains a no-op. Reminder-fired captures and retention retain their runtime-owned system origin.

ILatticeBackupCatalogStore

The durable, introspectable index of manifests, persisted into the reserved sys-backup-catalog tree keyed by backup id.

  • Task RegisterAsync(BackupManifest manifest, CancellationToken cancellationToken = default) - registers or replaces a manifest, keyed by manifest.Id. Re-registering an id that is already catalogued carries the existing row's CreatedAtUtc forward (a backup id is a content address, so the capture time is immutable) and records the later of the two registrations' ranking times as LastCapturedAtUtc; every other field, set membership included, takes the incoming manifest's value. Idempotent. Throws ArgumentNullException when manifest is null.
  • Task<BackupManifest?> GetAsync(string backupId, CancellationToken cancellationToken = default) - reads a manifest, or null. Throws ArgumentException when backupId is null or empty.
  • Task<bool> RemoveAsync(string backupId, CancellationToken cancellationToken = default) - removes a manifest; returns true when one was removed. Throws ArgumentException when backupId is null or empty.
  • IAsyncEnumerable<BackupManifest> ListAsync(CancellationToken cancellationToken = default) - enumerates every catalogued manifest in backup-id order.

ILatticeBackupSink

The pluggable storage sink a backup is written to and restored from. Stores streamed artifacts and self-describing manifests; the artifact surface moves the payload as an ordered chunk sequence so a large tree streams without being materialized whole. Re-writing the same artifact id with the same content is idempotent. The capture engine names each artifact with a per-capture id (scope tree id, scope kind, capture ticks, and a GUID) and records the artifact's SHA-256 digest (BackupContentHash) in the manifest's content descriptor; the content-addressed id is the backup (manifest) id, not the artifact id.

Capability members:

  • bool IsDurable - whether the sink stores payload outside the cluster it protects (an external, durable store such as Azure Blob or the filesystem sample sink), as opposed to the ephemeral in-cluster sink whose payload shares the fate of the cluster. Disaster-recovery features that only make sense against an off-cluster store - notably the periodic backup-health monitor - gate themselves on this flag: false keeps the monitor inert and hides the Explorer health column.

Artifact members:

  • Task WriteArtifactAsync(string artifactId, IAsyncEnumerable<ReadOnlyMemory<byte>> content, CancellationToken cancellationToken = default) - writes an artifact as an ordered chunk stream. Idempotent for the same id and content. Throws ArgumentException (artifactId null/empty) and ArgumentNullException (content null).
  • IAsyncEnumerable<ReadOnlyMemory<byte>> ReadArtifactAsync(string artifactId, CancellationToken cancellationToken = default) - reads an artifact back as an ordered chunk stream; yields nothing when absent. Throws ArgumentException when artifactId is null or empty.
  • Task<bool> DeleteArtifactAsync(string artifactId, CancellationToken cancellationToken = default) - removes an artifact; returns true when one was removed. Throws ArgumentException when artifactId is null or empty.
  • IAsyncEnumerable<string> ListArtifactIdsAsync(CancellationToken cancellationToken = default) - enumerates every artifact id in id order.

Manifest members:

  • Task WriteManifestAsync(BackupManifest manifest, CancellationToken cancellationToken = default) - creates or replaces a manifest keyed by manifest.Id. Idempotent. Throws ArgumentNullException when manifest is null.
  • Task<BackupManifest?> ReadManifestAsync(string backupId, CancellationToken cancellationToken = default) - reads a manifest, or null. Throws ArgumentException when backupId is null or empty.
  • IAsyncEnumerable<BackupManifest> ListManifestsAsync(CancellationToken cancellationToken = default) - enumerates every manifest in backup-id order.
  • Task<bool> DeleteManifestAsync(string backupId, CancellationToken cancellationToken = default) - removes a manifest; returns true when one was removed. Does not remove referenced artifacts. Throws ArgumentException when backupId is null or empty.

Sink-existence probe members (read-only, cheap - existence and committed-metadata only, never downloading or hashing payload):

  • Task<bool> ManifestExistsAsync(string backupId, CancellationToken cancellationToken = default) - the cheap liveness check used at selection time: true when the manifest is present in the sink. Throws ArgumentException when backupId is null or empty.
  • Task<BackupSinkResolution> ProbeAsync(string backupId, CancellationToken cancellationToken = default) - the richer resolvability probe used by reconcile / scrub: reports whether the manifest is present and which referenced artifacts are missing (absent, or - for sinks that mark commit - present but not committed). Throws ArgumentException when backupId is null or empty.

ILatticeBackupCatalogScrubService

Reconciles the in-cluster catalog against the durable sink in the opposite direction to the rebuild service: it finds catalog rows the sink can no longer resolve (orphans) rather than sink manifests the catalog is missing.

  • Task<BackupCatalogScrubReport> ScrubAsync(bool pruneOrphans = false, CancellationToken cancellationToken = default) - enumerates every catalog row and probes the sink (ILatticeBackupSink.ProbeAsync) for its resolvability, collecting the orphans - rows whose sink payload (manifest, or a referenced artifact) is gone. Non-destructive by default: it only flags orphans. When pruneOrphans is true it removes each orphan catalog row under system origin, which is idempotent on re-run (a pruned orphan is no longer scanned). Returns a BackupCatalogScrubReport summarizing counts scanned, orphaned, and removed, whether pruning ran, and the orphan backup ids.

ILatticeBackupCatalogRebuildService

Rebuilds the in-cluster catalog from the durable sink, treating the sink as the single source of truth and the catalog as a rebuildable, self-healing projection over it.

  • Task<BackupCatalogRebuildReport> RebuildFromSinkAsync(CancellationToken cancellationToken = default) - scans every manifest the sink holds (via ILatticeBackupSink.ListManifestsAsync) and re-registers each into the catalog under system-origin. Idempotent and safe to re-run: a manifest already catalogued is reconciled in place (keeping its immutable capture timestamp) rather than duplicated, and a catalog missing rows the sink has is repopulated. Returns a BackupCatalogRebuildReport summarizing counts scanned, freshly added, and reconciled.

ILatticeBackupColdRestoreService

Restores a backup into a fresh cluster from the durable sink alone, with zero dependency on any surviving sys-backup-catalog tree. This is the disaster-recovery entry point: a cluster that lost its grain storage (so its catalog is gone) but still has the external sink can enumerate, resolve, chain-walk, and restore its backups from the sink.

  • Task<LatticeRestoreResult> ColdRestoreAsync(LatticeRestoreRequest request, CancellationToken cancellationToken = default) - bootstraps the reserved sys- trees if they are absent, resolves the target (tip) manifest from the sink alone (never the catalog), then hands the request to the ordinary restore engine (ILatticeBackupRestoreService.RestoreAsync), which walks the BaseBackupId chain catalog-first with a sink fallback - so on a cluster that lost its catalog the whole chain resolves from the sink - validates every referenced artifact, read from the sink, against its recorded digest, and replays the chain through the HLC-preserving seams; it then re-projects the catalog from the sink so the recovered cluster is left with a correct catalog. Reuses LatticeRestoreRequest / LatticeRestoreResult. Idempotent. Throws LatticeRestoreValidationException when the backup is absent from the sink, the base chain is broken, or an artifact is missing or tampered; LatticeAuthorizationDeniedException when the caller is not authorized (the delegated restore authorizes exactly as RestoreAsync does); and ArgumentNullException when request is null. The delegated restore can also throw the other exceptions RestoreAsync documents.

ILatticeBackupHealthService

Verifies that a backup's durable sink payload is present and intact, layering content-hash verification on top of the cheap presence probe. Registered by AddLatticeBackup.

  • Task<BackupHealthReport> VerifyAsync(string backupId, CancellationToken cancellationToken = default) - resolves the backup's manifest, checks presence and committed-metadata of every referenced artifact (reusing ILatticeBackupSink.ProbeAsync), then downloads each present artifact and re-hashes it against its recorded BackupContentDescriptor.ContentHash to catch silent corruption. Returns a fresh point-in-time BackupHealthReport; does not persist it. Throws ArgumentException when backupId is null or empty.

ILatticeBackupHealthStore

Persists per-backup health state - the latest BackupHealthReport and the per-backup BackupHealthConfig - in the reserved sys-backup-health ILattice tree keyed by backup id, so the periodic monitor that writes reports and the UI that reads them share one durable projection (no second external store). Registered by AddLatticeBackup.

  • Task SetReportAsync(BackupHealthReport report, CancellationToken cancellationToken = default) - persists (or replaces) the latest report for its BackupId. Throws ArgumentNullException when report is null.
  • Task<BackupHealthReport?> GetReportAsync(string backupId, CancellationToken cancellationToken = default) - reads the latest report, or null. Throws ArgumentException when backupId is null or empty.
  • IAsyncEnumerable<BackupHealthReport> ListReportsAsync(CancellationToken cancellationToken = default) - enumerates every stored report in backup-id order.
  • Task<bool> RemoveAsync(string backupId, CancellationToken cancellationToken = default) - removes the stored report and configuration for a backup; returns true when anything was removed. Throws ArgumentException when backupId is null or empty.
  • Task SetConfigAsync(string backupId, BackupHealthConfig config, CancellationToken cancellationToken = default) - persists (or replaces) the per-backup monitor configuration. Throws ArgumentException (backupId null/empty) and ArgumentNullException (config null).
  • Task<BackupHealthConfig?> GetConfigAsync(string backupId, CancellationToken cancellationToken = default) - reads the per-backup configuration, or null when the backup uses the configured defaults. Throws ArgumentException when backupId is null or empty.

The periodic monitor itself is an internal reminder-driven grain (mirroring the backup scheduler): once per sweep it enumerates the catalog and re-verifies each enrolled backup whose configured interval has elapsed, writing the result through ILatticeBackupHealthStore. It is inert unless the registered sink reports IsDurable and LatticeBackupHealthOptions.Enabled is true.