#[non_exhaustive]pub struct Capabilities {
pub hard_link: bool,
pub sync_dir: bool,
pub atomic_rename: bool,
pub file_lock: bool,
pub threads: bool,
pub durable_sync: bool,
}Expand description
What a given Env can actually do.
regolith reads this at open and adapts: an environment without
hard_link copies bytes for a checkpoint, and one without
sync_dir is warned about at open and reported through
crate::Db::capabilities rather than being allowed to claim a
durability it does not provide.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.hard_link: boolEnv::hard_link creates a real link. false makes
checkpoints copy bytes instead.
sync_dir: boolEnv::sync_dir is real. false narrows regolith’s crash
guarantee to file contents: a create, rename, or unlink may be
lost even though the bytes survived.
atomic_rename: boolEnv::rename over an existing entry is atomic across a
crash.
file_lock: boolEnv::lock_file excludes other processes. false does not
mean no exclusion at all: every environment regolith ships refuses
a second crate::Db on one directory inside one process, and
on a single-process target such as wasm that is the whole
guarantee. What false says is that a second process is not
excluded, so concurrent access from one is undefined.
threads: boolEnv::spawn can create a thread.
durable_sync: boolWriteFile::sync_all makes bytes durable.
Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub const fn none() -> Self
pub const fn none() -> Self
Nothing available. The starting point for a backend that then declares only what it can genuinely do.
Sourcepub const fn with_hard_link(self, yes: bool) -> Self
pub const fn with_hard_link(self, yes: bool) -> Self
Sourcepub const fn with_sync_dir(self, yes: bool) -> Self
pub const fn with_sync_dir(self, yes: bool) -> Self
Sourcepub const fn with_atomic_rename(self, yes: bool) -> Self
pub const fn with_atomic_rename(self, yes: bool) -> Self
Sourcepub const fn with_file_lock(self, yes: bool) -> Self
pub const fn with_file_lock(self, yes: bool) -> Self
Sourcepub const fn with_threads(self, yes: bool) -> Self
pub const fn with_threads(self, yes: bool) -> Self
Sourcepub const fn with_durable_sync(self, yes: bool) -> Self
pub const fn with_durable_sync(self, yes: bool) -> Self
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more