Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.

FieldTypeDescription
filestable<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.

ActionArgumentsDescription
openpath: 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.
setpath: string, key: string, value?: anySets 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.

Source: supervisor/src/capabilities/storage/