pub struct VelesConfig {
pub search: SearchConfig,
pub hnsw: HnswConfig,
pub storage: StorageConfig,
pub limits: LimitsConfig,
pub server: ServerConfig,
pub logging: LoggingConfig,
pub quantization: QuantizationConfig,
pub wal_batch: WalBatchConfig,
}Expand description
Main VelesDB configuration structure.
Fields§
§search: SearchConfigSearch configuration.
hnsw: HnswConfigHNSW index configuration.
storage: StorageConfigStorage configuration.
limits: LimitsConfigLimits configuration.
server: ServerConfigServer configuration.
logging: LoggingConfigLogging configuration.
quantization: QuantizationConfigQuantization configuration.
wal_batch: WalBatchConfigWAL group commit batching configuration.
Implementations§
Source§impl VelesConfig
impl VelesConfig
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Loads configuration from default sources.
Priority: defaults < file < environment variables.
§Errors
Returns ConfigError if the configuration file is malformed or
environment variables contain invalid values.
Sourcepub fn load_from_path<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
pub fn load_from_path<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
Sourcepub fn from_toml(toml_str: &str) -> Result<Self, ConfigError>
pub fn from_toml(toml_str: &str) -> Result<Self, ConfigError>
Sourcepub fn load_from_path_engine_only<P: AsRef<Path>>(
path: P,
) -> Result<Self, ConfigError>
pub fn load_from_path_engine_only<P: AsRef<Path>>( path: P, ) -> Result<Self, ConfigError>
Loads configuration from a specific file path, considering only
the engine sections ([search]/[hnsw]/[storage]/[limits]/
[quantization]/[wal_batch]) and silently dropping any other
top-level table before parsing — notably [server] and [logging].
Use this instead of Self::load_from_path when the TOML file is
shared with a hosting shell that owns its own [server]/
[auth]/[tls]/[cors]/… sections under possibly-colliding
keys — e.g. velesdb-server --config reads the same file for its
own HTTP transport settings ([server].port = the bind port) and
for this engine config. Without filtering, [server] port = 443
(a perfectly legitimate low bind port, e.g. behind setcap/a
privileged process) would also land in this struct’s
server.port and be rejected by Self::validate’s port >= 1024 rule — a spurious failure with nothing to do with the actual
value being configured.
As with Self::load_from_path, VELESDB_* environment variables
are layered on top of the (filtered) file and can still override an
engine value — e.g. VELESDB_LIMITS_MAX_COLLECTIONS=5 overrides a
[limits] max_collections from the file. Env vars for non-engine
sections (VELESDB_SERVER_*, VELESDB_LOGGING_*, …) are
harmless here: they don’t match any field once those sections are
filtered out of the base document, so they’re ignored the same way
an unrecognised key always is.
§Errors
Returns an error if the file cannot be read, is not valid TOML, or fails validation.
Sourcepub fn from_toml_engine_only(toml_str: &str) -> Result<Self, ConfigError>
pub fn from_toml_engine_only(toml_str: &str) -> Result<Self, ConfigError>
Same as Self::load_from_path_engine_only but from an in-memory
TOML string, with no environment-variable layer — mirrors how
Self::from_toml relates to Self::load_from_path.
§Errors
Returns an error if toml_str is not valid TOML or fails
validation.
Sourcepub fn effective_ef_search(&self) -> usize
pub fn effective_ef_search(&self) -> usize
Returns the effective ef_search value.
Source§impl VelesConfig
impl VelesConfig
Trait Implementations§
Source§impl Clone for VelesConfig
impl Clone for VelesConfig
Source§fn clone(&self) -> VelesConfig
fn clone(&self) -> VelesConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VelesConfig
impl Debug for VelesConfig
Source§impl Default for VelesConfig
impl Default for VelesConfig
Source§fn default() -> VelesConfig
fn default() -> VelesConfig
Source§impl<'de> Deserialize<'de> for VelesConfigwhere
VelesConfig: Default,
impl<'de> Deserialize<'de> for VelesConfigwhere
VelesConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for VelesConfig
impl RefUnwindSafe for VelesConfig
impl Send for VelesConfig
impl Sync for VelesConfig
impl Unpin for VelesConfig
impl UnsafeUnpin for VelesConfig
impl UnwindSafe for VelesConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);