pub struct EncryptedAtomicDatabase<T: EncryptedDataStore> { /* private fields */ }Expand description
Synchronized Wrapper, that automatically saves changes when path and tmp are defined
Implementations§
Source§impl<T: EncryptedDataStore + DeserializeOwned> EncryptedAtomicDatabase<T>
impl<T: EncryptedDataStore + DeserializeOwned> EncryptedAtomicDatabase<T>
Sourcepub fn load<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
pub fn load<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
Loads the database with the provided password.
Sourcepub fn create_from_str<P: AsRef<Path>>(
data: &str,
path: P,
password: &str,
) -> Result<Self>
pub fn create_from_str<P: AsRef<Path>>( data: &str, path: P, password: &str, ) -> Result<Self>
Loads the database from a string with the provided password and save it to the filesystem. It checks if the provided password can decrypt the content successfully before saving it.
Sourcepub fn create_new<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
pub fn create_new<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
Creates a new database and save it with the provided password.
Sourcepub fn read(&self) -> EncryptedAtomicDatabaseRead<'_, T>
pub fn read(&self) -> EncryptedAtomicDatabaseRead<'_, T>
Locks the database for reading.
Sourcepub fn write(&self) -> EncryptedAtomicDatabaseWrite<'_, T>
pub fn write(&self) -> EncryptedAtomicDatabaseWrite<'_, T>
Locks the database for writing. Saves changes atomically on drop.
Sourcepub fn change_password(&self, new_password: &str) -> Result<()>
pub fn change_password(&self, new_password: &str) -> Result<()>
Changes the password of the database. This will re-encrypt the data with a new key derived from the new password.
Trait Implementations§
Source§impl<T: EncryptedDataStore> Debug for EncryptedAtomicDatabase<T>
impl<T: EncryptedDataStore> Debug for EncryptedAtomicDatabase<T>
Source§impl<T: EncryptedDataStore> Drop for EncryptedAtomicDatabase<T>
impl<T: EncryptedDataStore> Drop for EncryptedAtomicDatabase<T>
Auto Trait Implementations§
impl<T> !Freeze for EncryptedAtomicDatabase<T>
impl<T> !RefUnwindSafe for EncryptedAtomicDatabase<T>
impl<T> Send for EncryptedAtomicDatabase<T>where
T: Send,
impl<T> Sync for EncryptedAtomicDatabase<T>
impl<T> Unpin for EncryptedAtomicDatabase<T>where
T: Unpin,
impl<T> UnwindSafe for EncryptedAtomicDatabase<T>where
T: UnwindSafe,
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