pub struct Config {Show 16 fields
pub graph_model: GraphModel,
pub path: Option<PathBuf>,
pub memory_limit: Option<usize>,
pub spill_path: Option<PathBuf>,
pub threads: usize,
pub wal_enabled: bool,
pub wal_flush_interval_ms: u64,
pub backward_edges: bool,
pub query_logging: bool,
pub adaptive: AdaptiveConfig,
pub factorized_execution: bool,
pub wal_durability: DurabilityMode,
pub storage_format: StorageFormat,
pub schema_constraints: bool,
pub query_timeout: Option<Duration>,
pub gc_interval: usize,
}Expand description
Database configuration.
Fields§
§graph_model: GraphModelGraph data model (LPG or RDF). Immutable after database creation.
path: Option<PathBuf>Path to the database directory (None for in-memory only).
memory_limit: Option<usize>Memory limit in bytes (None for unlimited).
spill_path: Option<PathBuf>Path for spilling data to disk under memory pressure.
threads: usizeNumber of worker threads for query execution.
wal_enabled: boolWhether to enable WAL for durability.
wal_flush_interval_ms: u64WAL flush interval in milliseconds.
backward_edges: boolWhether to maintain backward edges.
query_logging: boolWhether to enable query logging.
adaptive: AdaptiveConfigAdaptive execution configuration.
factorized_execution: boolWhether to use factorized execution for multi-hop queries.
When enabled, consecutive MATCH expansions are executed using factorized representation which avoids Cartesian product materialization. This provides 5-100x speedup for multi-hop queries with high fan-out.
Enabled by default.
wal_durability: DurabilityModeWAL durability mode. Only used when wal_enabled is true.
storage_format: StorageFormatStorage format for persistent databases.
Auto (default) detects the format from the path: .grafeo extension
uses single-file format, directories use the legacy WAL directory.
schema_constraints: boolWhether to enable catalog schema constraint enforcement.
When true, the catalog enforces label, edge type, and property constraints (e.g. required properties, uniqueness). The server sets this for JSON Schema databases and populates constraints after creation.
query_timeout: Option<Duration>Maximum time a single query may run before being cancelled.
When set, the executor checks the deadline between operator batches and
returns QueryError::timeout() if the wall-clock limit is exceeded.
None means no timeout (queries may run indefinitely).
gc_interval: usizeRun MVCC version garbage collection every N commits.
Old versions that are no longer visible to any active transaction are pruned to reclaim memory. Set to 0 to disable automatic GC.
Implementations§
Source§impl Config
impl Config
Sourcepub fn persistent(path: impl Into<PathBuf>) -> Self
pub fn persistent(path: impl Into<PathBuf>) -> Self
Creates a new configuration for a persistent database.
Sourcepub fn with_memory_limit(self, limit: usize) -> Self
pub fn with_memory_limit(self, limit: usize) -> Self
Sets the memory limit.
Sourcepub fn with_threads(self, threads: usize) -> Self
pub fn with_threads(self, threads: usize) -> Self
Sets the number of worker threads.
Sourcepub fn without_backward_edges(self) -> Self
pub fn without_backward_edges(self) -> Self
Disables backward edges.
Sourcepub fn with_query_logging(self) -> Self
pub fn with_query_logging(self) -> Self
Enables query logging.
Sourcepub fn with_memory_fraction(self, fraction: f64) -> Self
pub fn with_memory_fraction(self, fraction: f64) -> Self
Sets the memory budget as a fraction of system RAM.
Sourcepub fn with_spill_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_spill_path(self, path: impl Into<PathBuf>) -> Self
Sets the spill directory for out-of-core processing.
Sourcepub fn with_adaptive(self, adaptive: AdaptiveConfig) -> Self
pub fn with_adaptive(self, adaptive: AdaptiveConfig) -> Self
Sets the adaptive execution configuration.
Sourcepub fn without_adaptive(self) -> Self
pub fn without_adaptive(self) -> Self
Disables adaptive execution.
Sourcepub fn without_factorized_execution(self) -> Self
pub fn without_factorized_execution(self) -> Self
Disables factorized execution for multi-hop queries.
This reverts to the traditional flat execution model where each expansion creates a full Cartesian product. Only use this if you encounter issues with factorized execution.
Sourcepub fn with_graph_model(self, model: GraphModel) -> Self
pub fn with_graph_model(self, model: GraphModel) -> Self
Sets the graph data model.
Sourcepub fn with_wal_durability(self, mode: DurabilityMode) -> Self
pub fn with_wal_durability(self, mode: DurabilityMode) -> Self
Sets the WAL durability mode.
Sourcepub fn with_storage_format(self, format: StorageFormat) -> Self
pub fn with_storage_format(self, format: StorageFormat) -> Self
Sets the storage format for persistent databases.
Sourcepub fn with_schema_constraints(self) -> Self
pub fn with_schema_constraints(self) -> Self
Enables catalog schema constraint enforcement.
Sourcepub fn with_query_timeout(self, timeout: Duration) -> Self
pub fn with_query_timeout(self, timeout: Duration) -> Self
Sets the maximum time a query may run before being cancelled.
Sourcepub fn with_gc_interval(self, interval: usize) -> Self
pub fn with_gc_interval(self, interval: usize) -> Self
Sets the MVCC garbage collection interval (every N commits).
Set to 0 to disable automatic GC.
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validates the configuration, returning an error for invalid combinations.
Called automatically by GrafeoDB::with_config().
§Errors
Returns ConfigError if any setting is invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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,
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 more