Understanding snapshots
Section titled “Understanding snapshots”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.
Lease and lifecycle
Section titled “Lease and lifecycle”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:
{ "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.)
| Operation | Endpoint | Behavior |
|---|---|---|
| Create snapshot | POST …/snapshots | Captures the namespace’s current state under a new snapshot_id. |
| List snapshots | GET …/snapshots | Lists live snapshots; deleted and expired snapshots are omitted. |
| Extend snapshot | POST …/snapshots/{snapshot_id}/extend | Extends expiry relative to the server’s current time without moving it earlier. |
| Delete snapshot | DELETE …/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.
Reading a snapshot
Section titled “Reading a snapshot”Pass snapshot_id to supported read operations:
| Read | Snapshot behavior |
|---|---|
| Stat a path | Returns the entry as of the snapshot. |
| Stat an inode | Returns the inode entry as of the snapshot. |
| List path entries | Lists the directory state. |
| List inode children | Lists the directory state by inode ID. |
| Get file content | Reads the file revision as of the snapshot. |
| Create a download | Grants access to the snapshotted file revision. |
| List file revisions | Lists the file’s revisions, starting at the revision the snapshot captured. |
| List file revisions by inode | Lists the file’s revisions by inode ID, starting at the revision the snapshot captured. |
| List changes | Lists 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.
Snapshots, checkpoints, and forks
Section titled “Snapshots, checkpoints, and forks”A snapshot is the durable pin used to keep a captured view readable. LoonFS tracks two kinds of snapshot owners:
| Owner | Purpose | Lifetime |
|---|---|---|
user | Application-created read views, including long-lived checkpoints. | Until explicit deletion or optional expiry. |
fork | Preserve 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.
loonfs snapshot create --namespace demo --name nightly-export --ttl-ms 3600000loonfs snapshot list --namespace demoloonfs use demoloonfs 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}