This page describes MobKit-specific storage adapters. It does not replace Meerkat’s own runtime-backed session durability model.
MobKit storage backends
JSON file store
The default adapter writes session state snapshots as JSON files to a local directory. Each session gets its own file, and concurrent access is managed through lock files.{session_id}.lock). The lock contains a JsonStoreLockRecord with the process ID and acquisition timestamp.
Stale lock recovery. If a process crashes while holding a lock, the lock becomes stale. On the next access attempt, the store checks whether the PID in the lock record is still alive. Dead PIDs trigger automatic lock recovery — the stale lock is removed and a new one is acquired.
BigQuery adapter
For production-oriented deployments, the BigQuery adapter writes session rows to a configured dataset and table:- Dataset and table names must be non-empty
- Only alphanumeric characters, underscores, and hyphens are allowed
Session persistence rows
Session state is serialized asSessionPersistenceRow records:
Session store contracts
TheSessionStoreContract defines the operations every backend must implement:
Contracts are verified by integration tests that run the same test suite against every backend implementation.
Materialization
MobKit provides two materialization functions for session inspection:materialize_latest_session_rows— returns the most recent row per sessionmaterialize_live_session_rows— returns rows for currently active sessions
On-disk layout and durability
On persistent gateway launches (persistent_state), session state lives in
the state directory under names owned by MobKitStorageLayout, MobKit’s
single path authority: the canonical session database is sessions.sqlite3
(Meerkat’s realm spelling), and the runtime store — session resume, archive,
retire — is runtime.sqlite. Legacy spellings (sessions.db,
sessions.sqlite) remain readable through canonical-name-first probing: a
single existing spelling is used where it lies, but two spellings of the
same store refuse startup (error -32014, “file-name twins”) and point at
mobkit/storage/doctor — renames happen only through the storage migrate
verb.
Durability is fail-closed: a runtime store that cannot open is a startup
error, never a silent in-memory fallback. Running sessions in-memory on a
persistent launch requires the explicit declaration
runtime_options.runtime_store = {"storage": "memory"}
(runtime_store.memory() / runtimeStore.memory() in the SDKs), and the
choice is visible in the storage census on mobkit/status →
storage.slots. See
Configuration → Storage layout and durability.
Runtime correlation
When MobKit accepts amobkit/send_message request, the response includes the Meerkat session_id that accepted the message. Treat that value as the canonical correlation handle for follow-up inspection, debugging, and resume-aware flows.
See also
- Configuration — session store settings, storage layout, durability classes
- RPC API —
session_store.*methods,mobkit/storage/doctor - BigQuery naming — naming validation rules
