Module storage
Expand description
Where an app keeps what is not a document: one seam for app files, preferences and secrets, the same on Linux, macOS and the web.
| What | Seam | Backed by |
|---|---|---|
| Documents (collaborative, synced) | resources and records | Automerge records |
| App files (caches, imports, databases) | AppFiles, HostContext::files | tilo_files::Dir in tilo_paths::AppPaths: the per-user directories natively, the origin-private file system in a page |
| Preferences | typed Settings with a declared Scope, HostContext::settings | the desktop settings document (settings-store), or the host’s settings source: in a sandboxed app the shell’s records, reached through the app’s collaboration channel; personal sections roam between the person’s devices |
| Secrets | secrets, HostContext::secrets; one per document item with SecretStore::item | tilo-secrets: the Secret Service, the Keychain, the page’s wrapped store |
AppStorage bundles the three for one app; framework views and
surfaces get it from their context instead of building paths.
Code with a HostContext uses its methods, which are scoped to the app
the host prepared. Code without one (a model loading its preferences
before the first frame) names the app or section itself. The older
entry points (settings_store, tilo-paths, tilo_files::native::atomic, app-state
from an app) are internals of these; apps other than Settings, which owns
the settings document, have no use for them.
Modules§
- __
serde_ json - Serde JSON
- waiting
- Threads that must never wait on storage.
Structs§
- AppFiles
- One app’s private file areas.
- AppPaths
- Where one app keeps its files, the same API on every target:
- AppStorage
- What an app keeps outside its documents, scoped to the app and the settings document its host gave it: its files, its secrets and its typed settings. Framework views and surfaces reach it through their context.
- Change
Origin - Who and what made a settings change: the action (or shell entry point, such as a fixed chord) that caused it, and the principal that invoked it.
- Dir
- A directory tree an app may use, and nothing outside it.
- Invoking
Action - The action that invoked another one, as a settings change records it.
- Open
Window - One open window of an app, as its other windows can tell, in every process: each holds a shared lock on one file. An app whose windows are processes of their own (each Browser tab) learns from it when its last window closes, the moment “the app closes” means.
- Settings
- An app’s typed settings of one
SettingsSchematype, in the settings document its host gave it. Get one fromHostContext::settings,AppStorage::settings, or a framework view’scx.settings::<T>(). - Settings
Cache - Settings
Tas last read, read again only when their document changed since: a reader that looks at them often (on every frame, on every publication of an app’s rows) without decoding them each time. - Settings
Revision - One version of a settings document, for readers that follow it.
- Settings
Section - One untyped section of the desktop settings document, for the owner of a
shared section (Settings, the theme store) and readers of one that has
no
SettingsSchematype yet. Apps keep their own preferences in a typedSettings. Reads never fail; a missing, unreadable or malformed document reads as empty. Writes merge the given keys into the section and keep every other section and key.
Enums§
- Device
Class - The kinds of device a setting’s default may differ on.
- FsError
- Why a file operation failed. Every backend reports the same variants for the same situation, so callers match on them rather than on OS codes.
- Location
- Where something lives. Native targets give paths; the web gives virtual roots, and so does a native process that has no home directory, whose storage then lasts only as long as the process.
- Scope
- Where an app’s typed settings live and how far they travel. Settings follow a person or a device, never a workspace’s members; they are never visible to collaborators. Content shared with a workspace is a record instead.
- Settings
Document - Which settings document a host gives its apps.
Traits§
- Settings
Schema - A typed settings value with a declared
Scope.
Functions§
- flush_
settings_ writes - Make every settings change stored before going on, which the native runner does before the process ends. No change waits for the disk when it is made.
- made_by
- Whether the change whose message is
messagewas made by an action whose id starts withaction_prefix(settings.appearance/), invoked byprincipal: what tells a section’s steps by one invoker apart in a document’s history. - parse_
settings - Parse settings-document text the way every reader does: anything malformed reads as an empty document.
- secrets
- This app’s secrets in the store the current host provides.
- settings_
at - The settings of the profile at
root, for code that compares two profiles.