Skip to main content

Settings

Struct Settings 

Source
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: Config

The 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: WorkspaceSettings

The [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

Source

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.

Source

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

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.