pub struct StorageConfig {
pub backend: String,
pub data_path: Option<PathBuf>,
pub in_memory: bool,
}Expand description
Storage backend configuration
Determines which storage implementation to use and how to configure it.
Fields§
§backend: StringBackend type identifier
Supported values:
"automerge-memory": Automerge in-memory (POC, testing)"redb": redb persistence (production target)
data_path: Option<PathBuf>Data directory path for persistent backends
Required for redb, optional for others.
Example: /var/cap/data, ./data, /tmp/cap-test
in_memory: boolRun in pure in-memory mode (no disk persistence)
When true, the automerge backend will skip all disk writes and store documents only in the LRU cache. Useful for high-throughput testing where persistence is not needed.
Implementations§
Source§impl StorageConfig
impl StorageConfig
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create configuration from environment variables
§Environment Variables
CAP_STORAGE_BACKEND(default: “automerge-memory”)CAP_DATA_PATH(optional, required for some backends)
§Returns
StorageConfig loaded from environment
§Example
export CAP_STORAGE_BACKEND=automerge-memory
export CAP_DATA_PATH=/var/cap/dataⓘ
let config = StorageConfig::from_env()?;
assert_eq!(config.backend, "automerge-memory");Trait Implementations§
Source§impl Clone for StorageConfig
impl Clone for StorageConfig
Source§fn clone(&self) -> StorageConfig
fn clone(&self) -> StorageConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StorageConfig
impl Debug for StorageConfig
Auto Trait Implementations§
impl Freeze for StorageConfig
impl RefUnwindSafe for StorageConfig
impl Send for StorageConfig
impl Sync for StorageConfig
impl Unpin for StorageConfig
impl UnsafeUnpin for StorageConfig
impl UnwindSafe for StorageConfig
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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