Skip to content

Snapshots

Preserve a point-in-time namespace view and read consistently from it.

A snapshot preserves a read-only view of a namespace. Creating one captures the current state and returns a snapshot_id; supported reads that supply that ID resolve against the captured state while the snapshot remains available, even as new commits stream in.

Snapshots may be useful for multi-step reads, generating exports, and changefeed consumers that need a fixed view of the namespace.

A name and TTL are optional. The TTL is measured from the server’s current time; omit it to keep the snapshot until explicitly deleted:

JSON
{
"name": "nightly-export",
"ttl_ms": 3600000
}

The response includes captured_seq, created_at_ms, and, when a TTL was supplied, expires_at_ms. (Snapshot names are just labels and do not need to be unique.)

OperationEndpointBehavior
Create snapshotPOST …/snapshotsCaptures the namespace’s current state under a new snapshot_id.
List snapshotsGET …/snapshotsLists live snapshots; deleted and expired snapshots are omitted.
Extend snapshotPOST …/snapshots/{snapshot_id}/extendExtends expiry relative to the server’s current time without moving it earlier.
Delete snapshotDELETE …/snapshots/{snapshot_id}Makes the snapshot unreadable; collection removes its record later. Repeated deletes succeed.

Extending a snapshot without an expiry leaves it unchanged. An expired snapshot cannot be extended; create a new one instead.

Pass snapshot_id to supported read operations:

ReadSnapshot behavior
Stat a pathReturns the entry as of the snapshot.
Stat an inodeReturns the inode entry as of the snapshot.
List path entriesLists the directory state.
List inode childrenLists the directory state by inode ID.
Get file contentReads the file revision as of the snapshot.
Create a downloadGrants access to the snapshotted file revision.
List file revisionsLists the file’s revisions, starting at the revision the snapshot captured.
List file revisions by inodeLists the file’s revisions by inode ID, starting at the revision the snapshot captured.
List changesLists changes through the snapshot’s greatest sequence.

Path-based content and download requests cannot combine snapshot_id with revision_no: the snapshot selects the revision. Inode revision routes can read a revision within the snapshot’s captured state. A snapshot-bounded changefeed cannot set after_seq above the captured sequence. Do not combine a snapshot with the live-read consistency setting. See Pagination & consistency.

A missing, expired, or deleted snapshot returns snapshot_not_found (404). LoonFS never silently falls back to the current namespace state.

A snapshot is the durable pin used to keep a captured view readable. LoonFS tracks two kinds of snapshot owners:

OwnerPurposeLifetime
userApplication-created read views, including long-lived checkpoints.Until explicit deletion or optional expiry.
forkPreserve inherited metadata and the fork’s starting view.Until the target fork is retired.

The public snapshot API manages user snapshots. Fork snapshots can be used for supported historical reads, but cannot be deleted through that API. A fork’s fork_basis.fork_point_snapshot_id preserves its starting view under the fork’s namespace ID.

Managing user snapshots requires administrator permissions or service context. Historical reads require read and history rights, evaluated at the current head.

Expiry or deletion makes a user snapshot unreadable before its storage is reclaimed. Its record continues protecting the captured manifest until garbage collection removes it after the grace window. See Checkpoints and Data lifecycle.

Commands
loonfs snapshot create --namespace demo --name nightly-export --ttl-ms 3600000
loonfs snapshot list --namespace demo
loonfs use demo
loonfs snapshot extend --namespace demo {snapshot_id} --ttl-ms 3600000
loonfs ls /reports --snapshot-id {snapshot_id}
loonfs get /reports/summary.csv --snapshot-id {snapshot_id}
loonfs changes --snapshot-id {snapshot_id}
loonfs snapshot delete --namespace demo {snapshot_id}