Struct bonsaidb_local::config::StorageConfiguration
source · [−]#[non_exhaustive]pub struct StorageConfiguration {
pub path: Option<PathBuf>,
pub memory_only: bool,
pub unique_id: Option<u64>,
pub vault_key_storage: Option<Arc<dyn AnyVaultKeyStorage>>,
pub default_encryption_key: Option<KeyId>,
pub workers: Tasks,
pub views: Views,
pub key_value_persistence: KeyValuePersistence,
pub default_compression: Option<Compression>,
pub argon: ArgonConfiguration,
/* private fields */
}Expand description
Configuration options for Storage.
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.path: Option<PathBuf>The path to the database. Defaults to db.bonsaidb if not specified.
memory_only: boolPrevents storing data on the disk. This is intended for testing purposes primarily. Keep in mind that the underlying storage format is append-only.
unique_id: Option<u64>The unique id of the server. If not specified, the server will randomly generate a unique id on startup. If the server generated an id and this value is subsequently set, the generated id will be overridden by the one specified here.
vault_key_storage: Option<Arc<dyn AnyVaultKeyStorage>>The vault key storage to use. If not specified,
LocalVaultKeyStorage will be
used with the server’s data folder as the path. This is incredibly
insecure and should not be used outside of testing.
For secure encryption, it is important to store the vault keys in a location that is separate from the database. If the keys are on the same hardware as the encrypted content, anyone with access to the disk will be able to decrypt the stored data.
default_encryption_key: Option<KeyId>The default encryption key for the database. If specified, all documents will be stored encrypted at-rest using the key specified. Having this key specified will also encrypt views. Without this, views will be stored unencrypted.
workers: TasksConfiguration options related to background tasks.
views: ViewsConfiguration options related to views.
key_value_persistence: KeyValuePersistenceControls how the key-value store persists keys, on a per-database basis.
default_compression: Option<Compression>Sets the default compression algorithm.
argon: ArgonConfigurationPassword hashing configuration.
Implementations
Trait Implementations
sourceimpl Builder for StorageConfiguration
impl Builder for StorageConfiguration
sourcefn with_schema<S: Schema>(self) -> Result<Self, Error>
fn with_schema<S: Schema>(self) -> Result<Self, Error>
Registers the schema and returns self.
sourcefn memory_only(self) -> Self
fn memory_only(self) -> Self
Sets StorageConfiguration::path to true and returns self.
sourcefn path<P: AsRef<Path>>(self, path: P) -> Self
fn path<P: AsRef<Path>>(self, path: P) -> Self
Sets StorageConfiguration::path to path and returns self.
sourcefn unique_id(self, unique_id: u64) -> Self
fn unique_id(self, unique_id: u64) -> Self
Sets StorageConfiguration::unique_id to unique_id and returns self.
sourcefn vault_key_storage<VaultKeyStorage: AnyVaultKeyStorage>(
self,
key_storage: VaultKeyStorage
) -> Self
fn vault_key_storage<VaultKeyStorage: AnyVaultKeyStorage>(
self,
key_storage: VaultKeyStorage
) -> Self
Sets StorageConfiguration::vault_key_storage to key_storage and returns self.
sourcefn default_encryption_key(self, key: KeyId) -> Self
fn default_encryption_key(self, key: KeyId) -> Self
Sets StorageConfiguration::default_encryption_key to path and returns self.
sourcefn default_compression(self, compression: Compression) -> Self
fn default_compression(self, compression: Compression) -> Self
Sets StorageConfiguration::default_compression to path and returns self.
sourcefn tasks_worker_count(self, worker_count: usize) -> Self
fn tasks_worker_count(self, worker_count: usize) -> Self
Sets Tasks::worker_count to worker_count and returns self.
sourcefn check_view_integrity_on_open(self, check: bool) -> Self
fn check_view_integrity_on_open(self, check: bool) -> Self
Sets Views::check_integrity_on_open to check and returns self.
sourcefn key_value_persistence(self, persistence: KeyValuePersistence) -> Self
fn key_value_persistence(self, persistence: KeyValuePersistence) -> Self
Sets StorageConfiguration::key_value_persistence to persistence and returns self.
sourceimpl Clone for StorageConfiguration
impl Clone for StorageConfiguration
sourcefn clone(&self) -> StorageConfiguration
fn clone(&self) -> StorageConfiguration
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for StorageConfiguration
impl Debug for StorageConfiguration
Auto Trait Implementations
impl !RefUnwindSafe for StorageConfiguration
impl Send for StorageConfiguration
impl Sync for StorageConfiguration
impl Unpin for StorageConfiguration
impl !UnwindSafe for StorageConfiguration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more