storage
Each persistent_table JSON file, keyed by absolute path.
Declare files with persistent_table: it sends these
actions and exposes each key as a signal. Saving, outside edits and a broken file are covered
there.
State
mantle.storage:get() returns StorageState, nil before the first push. A field marked ? may be absent.
mantle.storage payload.
| Field | Type | Description |
|---|---|---|
files | table<string, any> | Each declared persistent_table’s contents, keyed by its absolute file path; nil until declared. Another writer’s change to the file replaces it, unsaved writes included. |
Actions
Call each as mantle.storage:<action>(arguments...); ? marks an argument you may omit.
| Action | Arguments | Description |
|---|---|---|
open | path: string, defaults?: table<string, any> | Loads an absolute JSON file into files[path], filling missing top-level keys from defaults. persistent_table sends this; stored values win over defaults. |
set | path: string, key: string, value?: any | Sets key in a declared file, nil deleting it; saved 1 s after the last write. |
Backend
Plain JSON files at absolute paths, watched with inotify. A set pushes at once; the save follows
1 s later. Another writer’s change, another shell’s included, gets missing defaults refilled and
pushes.