Skip to content

Pools

How a namespace and its forks share file bytes without copying data.

If LoonFS stored each namespace’s file bytes under that namespace’s own prefix, forking a 1 TB namespace would either copy 1 TB of data or leave the fork pointing into another namespace that might later be deleted. Instead, LoonFS stores file bytes in a “pool” shared by a namespace and all of its forks.

A pool is a shared prefix in object storage (pools/{pool_id}/) that stores content objects, upload records, temporary staging objects, and a list of member namespaces. Each namespace belongs to one pool, identified by its pool ID (pool_id). Even when several namespaces share a pool, each namespace keeps its own paths, commits, metadata, and permissions.

You don’t create or delete pools directly. When you create a namespace, LoonFS creates a new pool for that namespace. When you fork a namespace, LoonFS adds the new fork to the parent namespace’s pool.

For example, if you create workspace, fork workspace into session, and fork session into experiment, all three namespaces return the same pool_id. A namespace’s pool is set when the namespace is created and can’t be changed later.

Because a fork shares its parent’s pool, forking doesn’t copy any existing file bytes, and merging a fork adds the fork’s file references to the parent without copying those bytes either. Any new file uploaded to either namespace is also written into the shared pool.

Sharing a pool shares stored bytes, not filesystem state or permissions. Commits to session don’t appear in workspace until you merge session into workspace. LoonFS also checks permissions against the namespace in the request, so belonging to the same pool doesn’t grant access to any other namespace in that pool.

A content reference points to bytes inside the reading namespace’s pool, so you can’t reference file bytes from a namespace in an unrelated pool. To copy a file between unrelated pools, upload the bytes into the destination namespace.

While content objects and upload records are stored under the pool prefix, each namespace stores its own manifests, write-ahead log, metadata segments, and snapshots under its namespace prefix. A fork can still read inherited metadata segments from its parent’s prefix because the fork’s snapshot protects those segments from deletion. See Storage model for the object-storage layout.

Because multiple namespaces in a pool can reference the same content object, garbage collection for namespaces and pools is split into two jobs:

  • Namespace garbage collection. Deletes obsolete manifests, folded WAL objects, expired snapshots, and unused metadata segments for one namespace.
  • Pool garbage collection. Inspects references across every member of the pool and deletes content objects, upload records, and temporary objects that no member references anymore (after their 24-hour grace period passes).

Deleting the namespace that originally uploaded a file doesn’t delete that file’s bytes if a fork in the same pool still references those bytes. Pool garbage collection checks every member of the pool before deleting shared content, so deleting one namespace doesn’t break another.

Deleting a fork also doesn’t free all of its storage right away, because old revisions, snapshots, upload records, and the 24-hour grace period can protect objects until later sweeps.

The reference server runs both namespace and pool garbage collection automatically during its scheduled sweeps. If you schedule maintenance yourself, run both jobs. To collect a pool, run loonfs maintenance pool gc or send POST /v0/maintenance/pools/{pool_id}/jobs with {"kind": "gc"}.

A pool disappears on its own once pool garbage collection deletes the last object under its prefix. See Data lifecycle for how retention, namespace retirement, and grace periods affect cleanup.