pub struct EngineBuilder { /* private fields */ }Expand description
Builder for an Engine.
The builder is the only public construction path. New fields can gain defaults without breaking callers.
Implementations§
Source§impl EngineBuilder
impl EngineBuilder
Sourcepub fn data_root(self, path: impl Into<PathBuf>) -> Self
pub fn data_root(self, path: impl Into<PathBuf>) -> Self
Sets the directory where durable worlds and the audit log live.
Default: ./data. The directory is created if missing.
Sourcepub fn key(self, key: SecretBytes) -> Self
pub fn key(self, key: SecretBytes) -> Self
Sets the HMAC key that protects the audit chain. Required.
Sourcepub fn read_token(self, token: impl Into<Vec<u8>>) -> Self
pub fn read_token(self, token: impl Into<Vec<u8>>) -> Self
Sets the optional read-tier token.
Empty or all-whitespace bytes are treated as “unset” — they never silently grant access.
Sourcepub fn write_token(self, token: impl Into<Vec<u8>>) -> Self
pub fn write_token(self, token: impl Into<Vec<u8>>) -> Self
Sets the optional write-tier token (covers read + write).
Empty or all-whitespace bytes are treated as “unset” — they never silently grant access.
Sourcepub fn approve_token(self, token: impl Into<Vec<u8>>) -> Self
pub fn approve_token(self, token: impl Into<Vec<u8>>) -> Self
Sets the optional approve-tier token (covers read + write + system writes + delete).
Empty or all-whitespace bytes are treated as “unset” — they never silently grant access.
Sourcepub fn max_world_bytes(self, value: usize) -> Self
pub fn max_world_bytes(self, value: usize) -> Self
Caps the per-world payload size in bytes. Defaults to 64 MiB.
Sourcepub fn max_memory_bytes(self, value: usize) -> Self
pub fn max_memory_bytes(self, value: usize) -> Self
Caps the in-memory backend’s total bytes. Defaults to 256 MiB.
Sourcepub fn max_storage_bytes(self, value: Option<usize>) -> Self
pub fn max_storage_bytes(self, value: Option<usize>) -> Self
Sets an optional durable storage quota in bytes.
Some(0) is treated as “no quota”. Writes that would push the total
past the quota fail with EngineError::QuotaExceeded.
Sourcepub fn max_listen_connections(self, value: usize) -> Self
pub fn max_listen_connections(self, value: usize) -> Self
Sets the maximum simultaneous subscription slots. 0 reverts to the
default (1024).
Sourcepub fn listen_replay_max(self, value: usize) -> Self
pub fn listen_replay_max(self, value: usize) -> Self
Sets the per-subscription replay ring depth. 0 reverts to the
default (1024).
Sourcepub fn read_cache_max_entries(self, value: usize) -> Self
pub fn read_cache_max_entries(self, value: usize) -> Self
Sets the read cache’s maximum tracked entries. 0 reverts to the
default (5000).
Sourcepub fn build(self) -> Result<Engine, EngineBuildError>
pub fn build(self) -> Result<Engine, EngineBuildError>
Acquires the data-root writer lock, verifies every audit chain, and
returns a ready-to-serve Engine.
§Errors
EngineBuildError::HmacKeyMissingifEngineBuilder::keywas never called.EngineBuildError::DataRootIofor filesystem errors creatingdata_root.EngineBuildError::DataRootLockHeldif another process holds the writer lock.EngineBuildError::AuditChainCorruptedif any existing world’s HMAC chain fails verification.EngineBuildError::Storagefor other storage-layer failures.