pub struct Config { /* private fields */ }Expand description
Settings for Database::open.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(path: impl Into<PathBuf>, app_id: &str) -> Self
pub fn new(path: impl Into<PathBuf>, app_id: &str) -> Self
A local database file at path for the application app_id (reverse domain name).
Sourcepub fn p2p(self, config: P2pConfig) -> Self
pub fn p2p(self, config: P2pConfig) -> Self
Opens direct channels to other online devices while background sync runs, so they see
each other’s writes within about a second. Off by default. See crate::p2p.
Sourcepub fn encrypt(self, password: &str) -> Self
pub fn encrypt(self, password: &str) -> Self
Creates the database encrypted with this password (init), and unlocks with it.
Sourcepub fn password(self, password: &str) -> Self
pub fn password(self, password: &str) -> Self
Unlocks an encrypted database with this password (on open and join).
Sourcepub fn key(self, key: DataKey) -> Self
pub fn key(self, key: DataKey) -> Self
Unlocks an encrypted database with a data key cached by the app.
Sourcepub fn kdf_cost(self, m_kib: u32, t: u32, p: u32) -> Self
pub fn kdf_cost(self, m_kib: u32, t: u32, p: u32) -> Self
Argon2id cost for key files this device writes (memory in KiB, passes, lanes). The
default is crate::crypto::DEFAULT_KDF_COST (64 MiB, 2, 1); tests may lower it.
Sourcepub fn snapshot_policy(self, policy: SnapshotPolicy) -> Self
pub fn snapshot_policy(self, policy: SnapshotPolicy) -> Self
Snapshot and compaction policy.
Sourcepub fn clock(self, clock: Arc<dyn Clock>) -> Self
pub fn clock(self, clock: Arc<dyn Clock>) -> Self
Replaces the wall clock (tests and simulations).
Sourcepub fn pack_limits(self, limits: PackLimits) -> Self
pub fn pack_limits(self, limits: PackLimits) -> Self
Segment size limits.
Sourcepub fn device_name(self, name: &str) -> Self
pub fn device_name(self, name: &str) -> Self
Human-readable device name written to device.json.
Sourcepub fn conflict_log(self, limit: Option<u32>) -> Self
pub fn conflict_log(self, limit: Option<u32>) -> Self
How many conflict records to keep (default 1,000); None turns the conflict log off.