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 records; crate::persist for a single-document appAutomerge 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.

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.
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>().
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§

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 room’s members; they are never visible to collaborators. Content shared with a room is a record instead.
SettingsDocument
Which settings document a host gives its apps.

Traits§

SettingsSchema
A typed settings value with a declared Scope.

Functions§

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 document at path, for code that compares two profiles.