Skip to main content

Module storage

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.

WhatSeamBacked by
Documents (collaborative, synced)resources and recordsAutomerge records
App files (caches, imports, databases)AppFiles, HostContext::filestilo_files::Dir in tilo_paths::AppPaths: the per-user directories natively, the origin-private file system in a page
Preferencestyped Settings with a declared Scope, HostContext::settingsthe 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
Secretssecrets, HostContext::secrets; one per document item with SecretStore::itemtilo-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.
ChangeOrigin
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.
InvokingAction
The action that invoked another one, as a settings change records it.
OpenWindow
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 SettingsSchema type, in the settings document its host gave it. Get one from HostContext::settings, AppStorage::settings, or a framework view’s cx.settings::<T>().
SettingsCache
Settings T as 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.
SettingsRevision
One version of a settings document, for readers that follow it.
SettingsSection
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 SettingsSchema type yet. Apps keep their own preferences in a typed Settings. 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§

DeviceClass
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.
SettingsDocument
Which settings document a host gives its apps.

Traits§

SettingsSchema
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 message was made by an action whose id starts with action_prefix (settings.appearance/), invoked by principal: 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.