Provider / file-backed relational state

Validated

SQLite

SQLite is the local durable option when the application owns database files and can apply the repository's locking and journal-mode rules. Metadata and blocks may use separate database files or be paired with another provider.

Metadata

SqliteMetadataStore stores the namespace JSON, revision, writer owner/fence/expiry, volume identity, and versioning tables inmount_rs_metadata plus the version tables.

Immutable blocks

SqliteBlockStore stores immutable bytes inmount_rs_blocks(id, bytes). It can live in a second SQLite database so metadata publication and block storage remain separate.

Storage anatomy

Follow one file through both planes.

A mount-rs namespace stores names, attributes, directory entries, layouts, and block references. The bytes stay in the independent block plane. The example below is illustrative; the provider-specific schema, keys, and prefixes are the inspectable contract.

Logical file/docs/readme.mdinode 42 · size 8,192NodeMetadata → NodeData::File(FileLayout)
blocksblocks.sqliteBlockId → raw bytes
Illustrative Namespace / FileLayout record (shape, not serialized bytes)
Namespace {
  nodes[42] = NodeMetadata {
    stats: { ino: 42, size: 8192, mode: regular },
    data: File(FileLayout {
      chunker: { algorithm: "fixed-size", version: 1, chunk_size: 4096 },
      extents: [
        { file_offset: 0,    block: "b012...", block_offset: 0, length: 4096 },
        { file_offset: 4096, block: "bfed...", block_offset: 0, length: 4096 }
      ]
    })
  }
}

BlockId "b012..." -> [4 KiB raw bytes]
BlockId "bfed..."  -> [4 KiB raw bytes]

Relational storage

SQLite file(s) schema

6 active tables

The current split-store schema is normalized into six active tables. Metadata and blocks can be separate SQLite files; the table names stay the same.

mount_rs_metadata

PK id = 1

One current namespace snapshot plus the writer lease and revision CAS state.

ColumnTypeStored meaning
idINTEGERfixed singleton key; CHECK(id=1)
volume_idTEXTstable volume identity; added by migration
revisionINTEGERmonotonic namespace revision
namespaceTEXT NULLserialized Namespace: nodes, attributes, layouts, block IDs
ownerTEXT NULLcurrent writer owner
fenceINTEGERmonotonic fencing token
expiresINTEGERprovider-clock lease expiry
blocks

mount_rs_blocks

PK id

Immutable byte blocks referenced by Namespace FileLayout extents.

ColumnTypeStored meaning
idTEXTopaque BlockId
bytesBLOBraw block bytes; never a path or directory record
control

mount_rs_schema_versions

PK schema_name

Migration marker for the versioning schema.

ColumnTypeStored meaning
schema_nameTEXTschema identifier
schema_versionINTEGERapplied schema version

mount_rs_version_state

PK id = 1

One row tracking the version head and the next sequence/fence values.

ColumnTypeStored meaning
idINTEGERfixed singleton key; CHECK(id=1)
volume_idTEXTvolume this version graph belongs to
head_idTEXT NULLcurrent published version
next_sequenceINTEGERnext version sequence
next_read_fenceINTEGERnext reader fence

mount_rs_versions

PK id

Published namespace snapshots and their parent/fork lineage.

ColumnTypeStored meaning
idTEXTversion identifier
volume_idTEXTowning volume
sequenceINTEGERmonotonic version sequence
parent_idTEXT NULLprevious version
restored_fromTEXT NULLrestore source, if any
forked_fromTEXT NULLfork source, if any
namespaceTEXTserialized namespace for this version
block_store_idTEXTblock-plane identity
kindTEXTpublication kind
created_at_msINTEGERcreation timestamp
durableINTEGERdurability assertion; 0 or 1
operation_idTEXTidempotency key; UNIQUE

mount_rs_version_pins

PK view_id

Reader views that pin a version while it is being consumed.

ColumnTypeStored meaning
view_idTEXTreader view identifier
volume_idTEXTowning volume
version_idTEXTpinned version
ownerTEXTreader owner
fenceINTEGERreader fence
expiresINTEGERpin expiry

Compatibility boundary

Legacy snapshot schema

not split-store tables

These tables belong to the older snapshot state-store API. They should not be mistaken for the active metadata/block composition.

legacy

mount_rs_state

PK id = 1

Legacy SqliteFs snapshot table; not part of the split MetadataStore/BlockStore schema above.

ColumnTypeStored meaning
idINTEGERfixed singleton key; CHECK(id=1)
revisionINTEGERsnapshot revision
snapshotBLOBserialized persisted filesystem snapshot

Only expect this table when the legacy SqliteFs state-store API is selected.

Read the live relational schema
SELECT name, sql
FROM sqlite_master
WHERE type = 'table' AND name LIKE 'mount_rs_%'
ORDER BY name;

PRAGMA table_info(mount_rs_metadata);
PRAGMA table_info(mount_rs_blocks);
PRAGMA table_info(mount_rs_versions);
Validated — scoped evidence

File-backed provider and Linux FUSE hosting have scoped evidence; not universal SQLite safety. Local provider tests and revision-matched Linux FUSE checks cover file reopen, leases, SQLite transactions, and selected recovery/fault paths. The repository still tracks hosted, Windows, and broader transport acceptance separately.

Layout and chunking

ChunkedFs records fixed-size chunk configuration in the namespace/file layout. A block row contains the opaque block ID and a BLOB; SQLite does not reinterpret the bytes as files or pages owned by the mount layer.

Durability and consistency

File-backed databases enable the provider's durable flag and use SQLite's synchronous=FULL setup plus provider-clock lease and revision checks. In-memory SQLite is volatile. SQLite used as a provider is different from hosting a separate SQLite database inside a native mount.

Across every split-store composition, new blocks are flushed before metadata references are published. A provider acknowledgement is not automatically a power-loss or distributed-locking guarantee.

Inspect metadata and blocks with sqlite3

Read-only inspection example
sqlite3 metadata.sqlite <<'SQL'
SELECT id, revision, length(namespace) AS namespace_bytes
FROM mount_rs_metadata;
SELECT id, sequence, durable FROM mount_rs_versions
ORDER BY sequence DESC LIMIT 10;
SQL

sqlite3 blocks.sqlite   'SELECT id, length(bytes) AS block_bytes FROM mount_rs_blocks LIMIT 20;'

Credentials, cleanup, and safe operations

Close all filesystem handles before copying or deleting database files. Remove only databases owned by the volume; never delete block rows that a live metadata revision may still reference. SQLite has no network credentials in this provider path.

Current limits

The provider's file durability does not prove safe SQLite hosting over every transport. The verified Linux FUSE matrix and macOS single-host NFS DELETE-journal path do not establish universal WAL, power-loss, distributed-locking, or cross-platform guarantees.

← Back to providers