Docs · Context FS
Inside Context FS.
Context FS is three layers of code: a client library shared by the FUSE daemon and the interceptors, the filesystem and stream modules in the runtime, and the CTE underneath. This page names the pieces and what each owns. The Filesystem and FUSE design page covers every operation and the consistency model in depth.
- Modules
- filesystem, stream
- Daemon
- clio_cte_fuse
- Page size
- 1 MiB blobs
- Directory block split
- 1024 entries
The pieces
How the namespace is stored
Caches and homes
stat or a miss in
a complete directory, and batch small writes before sending them.The client library
The FUSE daemon, the preloaded interceptors and the C++ API share one client library, so they behave the same. It keeps:
- A descriptor table mapping open files to the handle the inode's home node issued, so reads, writes and close go straight to that node.
- Synchronous writes: each write is stored before it returns, as one put per 1 MiB page range. Errors therefore return from the
writethat caused them. - Read and stat mirrors in shared memory, published by the runtime, so a warm
stator a read of a local RAM page needs no task at all.
The filesystem and stream modules
- Every object is a tag
- Each file, directory and symbolic link is a CTE tag. The tag id is the inode number and encodes the node that serves it, its home.
- Files
- Data lives in the file's tag as 1 MiB page blobs named by index; a missing page is a hole. A small inode record, stored as an attribute of the file's own tag, holds type, mode, owner, times, link count and a size snapshot. Extended attributes live in one global tag.
- Directories
- Entries live in directory-block blobs placed by name hash. A block over 1024 entries splits by the next hash bit; blocks never merge. Each entry is live, pending or leaving, which lets multi-step operations abort cleanly after a crash.
- Sizes and appends
- The stream module holds each file's logical size and orders concurrent appends from many nodes by staging them, then merging them in one order.
- Local path resolution
- Every path request goes to the local filesystem container, which walks the path from its cache of directory blocks. Blocks it does not own are fetched once, and the owner pushes later changes to it, so a warm walk costs no network round trip.
- Leases
- Cached namespace state is valid only under a lease, so a partitioned node can delay mutations but cannot serve stale names.
Crash safety
The filesystem and stream modules keep their node-local metadata in an append-only, self-checking record log: one write per mutation, replayed at startup with a torn tail cut off, then compacted. Operations are ordered so a crash leaks space rather than corrupting: the inode record is stored before its name appears, and link counts rise before links do. Directory blocks are ordinary CTE blobs, so the CTE's metadata log and replication protect them like file data. Inode records are tag attributes, which the replication module does not copy; instead the filesystem module mirrors each record, best effort, to the node that takes over the inode when its home is down.
The FUSE daemon
clio_cte_fuse is a runtime client. It translates kernel requests into client-library calls, configures the kernel's attribute and entry caches (see the FUSE daemon), and writes pages straight to the CTE chain and reads through the mirror fast paths. Those fast paths are single-node: on a multi-node mount, appends are staged and merged through the stream module.
Costs of this design
| Decision | Buys | Costs |
|---|---|---|
| Everything is a blob | One tiering, replication and durability mechanism for data and metadata | Metadata blobs consume tier space and logging like data |
| Synchronous page writes | Errors appear at the write that caused them | Every write waits for its pages to be stored |
| Multi-step rename | No distributed transactions | Intermediate states exist, though invisible or harmless |
| Leases | Never stale | Mutations can stall behind a partitioned holder |
See Filesystem and FUSE for each operation step by step.