Skip to content

Namespaces & forking

Understanding namespace creation, forking, and deletion.

A namespace is the identity of a collection of files and folders; think of it as the analogue of a “drive” or “collection” in other systems. It is also the isolation boundary of the system: operations in a given namespace are isolated and consistent, cross-namespace operations are not.

See also Inodes & paths.

A namespace ID can be supplied by the caller at creation time. If omitted, LoonFS generates one. While it is perfectly acceptable to choose human readable namespace names, most applications create namespaces programmatically with generated IDs.

Namespace ID rules:

RuleDetail
Length1–128 bytes
First characterA lowercase ASCII letter or a digit
Remaining charactersLowercase ASCII letters, digits, ., _, or -
Not allowedLeading or trailing whitespace; the exact values . and ..
ReservedThe loonfs- prefix
OperationEndpoint
Create namespacePOST /v0/namespaces
List namespacesGET /v0/namespaces
Get namespaceGET /v0/namespaces/{namespace_id}
Fork namespacePOST /v0/namespaces/{namespace_id}/forks
Delete namespaceDELETE /v0/namespaces/{namespace_id}

In the CLI, use namespace create, namespace list, namespace fork, namespace delete or use/current to select the active namespace.

Remember to include the required Loonfs-Actor header when creating or forking a namespace. The response records the actor ID as created_by. Permissions are selected per request: send Loonfs-Principals to check grants, or Loonfs-Context: service to act with the deployment token’s full authority. Forking requires this context; creating a namespace does not. Set initial grants with an update_access commit in service context. See Permissions.

For now, LoonFS intentionally does not expose a list-namespaces operation. instead, applications should keep their own catalog of namespace IDs.

Namespaces can be forked into new namespaces using a copy-on-write strategy. The fork belongs to the source’s pool and reuses its existing content.

The fork shares the source’s existing files instead of copying them. When forking the source’s current state, the fork folds recent writes from the source’s write-ahead log into its own manifest, so that fork can take a little longer.

Forking creates a fork snapshot on the source to protect inherited metadata, and a fork point snapshot on the new namespace to preserve its starting view. These pins last until the fork is retired and affect garbage collection.

Supply snapshot_id to fork a live snapshot’s captured state; otherwise the fork uses the source’s current head.

See Forking & merging for a complete workflow, and Data lifecycle for retention and retirement.