pub struct Settings {
pub database_path: Option<PathBuf>,
pub config: Config,
pub embedder: Option<Box<dyn Embedder>>,
pub snapshot_every_ops: Option<u64>,
pub snapshot_journal_bytes: Option<u64>,
pub maintain_every_forgets: Option<u64>,
pub fsync: Option<FsyncPolicy>,
pub workspace: WorkspaceSettings,
pub warnings: Vec<SettingWarning>,
}Expand description
Resolved runtime settings: the engine config, an optional embedder, and the
maintenance policy. The wrapper-specific knobs (import batch size, server
workers) are read separately from the same read_config table.
Fields§
§database_path: Option<PathBuf>[database].path, if set. Wrapper-specific explicit paths take
precedence over this value; otherwise the platform default is used.
config: ConfigThe engine configuration (size-bearing fields from [engine]).
embedder: Option<Box<dyn Embedder>>The embedder built from [embedder], or None (lexical/graph/time
recall still work without one).
snapshot_every_ops: Option<u64>[maintenance].snapshot_every_ops, if set.
snapshot_journal_bytes: Option<u64>[maintenance].snapshot_journal_bytes, if set.
maintain_every_forgets: Option<u64>[maintenance].maintain_every_forgets, if set.
fsync: Option<FsyncPolicy>[maintenance].fsync, if set. None leaves the engine default
(FsyncPolicy::EachOp) — every acknowledged write survives a power
cut. This is the largest single lever on write throughput, which is why
changing it is a deliberate config edit and not a per-call flag.
workspace: WorkspaceSettingsThe [workspace] section. Its dir is None unless the file names
one — the default is a single database, and nothing turns a
workspace on by itself.
warnings: Vec<SettingWarning>Sections and keys in the file that nothing claimed, in file order.
Empty for a clean config, which is why this is a field rather than an
error: a typo must not stop a program that was configured correctly
enough to run. Show them. A surface that drops these is back to the
silence this exists to end — see SettingWarning.
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn load(flag: Option<&Path>) -> Result<Settings, SettingsError>
pub fn load(flag: Option<&Path>) -> Result<Settings, SettingsError>
Loads settings from the config file resolved by read_config (an
explicit flag path, else $PLUGMEM_CONFIG, else the platform config
path from crate::default_config_path). Missing config → defaults.
Sourcepub fn from_table(table: Option<&Table>) -> Result<Settings, SettingsError>
pub fn from_table(table: Option<&Table>) -> Result<Settings, SettingsError>
Builds settings from an already-parsed config table (or None for
all defaults). $PLUGMEM_EMBEDDER_ENABLED overrides
[embedder].enabled. Use this when the caller also needs its own keys
from the same table (read once via read_config, then passed here).
Sourcepub fn open(self, path: &Path) -> Result<Database, HostError>
pub fn open(self, path: &Path) -> Result<Database, HostError>
Opens a read-write Database, applying the maintenance policy and
embedder to the builder. Consumes self (the embedder moves into the
database). For a read-only handle, take Settings::embedder out
first, then call Database::open_readonly with Settings::config.
Sourcepub fn open_workspace(self, root: &Path) -> Result<Workspace, WorkspaceError>
pub fn open_workspace(self, root: &Path) -> Result<Workspace, WorkspaceError>
Opens a Workspace rooted at root: many named databases, each built
with these same settings.
The embedder is shared rather than duplicated — a hundred chats pointed
at one endpoint want one client, not a hundred (see SharedEmbedder).
root is passed rather than read from WorkspaceSettings::dir so a
wrapper keeps its own precedence (flag, then environment, then config),
the same way it already does for the database path.
§Errors
Nothing yet — the databases open lazily, so a bad root is reported by
the first Workspace::get rather than here. The signature is
fallible because that is where the failure will move if the root ever
needs validating up front.