Struct encrypted_json_kv::Database[][src]

pub struct Database { /* fields omitted */ }

A KV store based on sled, storing serde_json::Value values in an encrypted fashion

Implementations

impl Database[src]

pub fn new(path: PathBuf, passphrase: &[u8]) -> Result<Self, DatabaseOpenError>[src]

Opens a new Database instance.

pub fn temporary() -> Result<Self, DatabaseOpenError>[src]

Opens a new temporary Database instance

pub fn set_passphrase(
    &self,
    passphrase: &[u8]
) -> Result<(), DatabaseSetPassphraseError>
[src]

pub fn get(&self, key: &str) -> Result<Option<Value>, DatabaseError>[src]

Get a serde_json::Value from the database. The wrapping sled::Result will only throw an error when something goes really wrong. The Option inside that Result indicates whether the requested item is present

pub fn insert(&self, key: &str, value: &Value) -> Result<(), DatabaseError>[src]

Insert a serde_json::Value into the database. The wrapping sled::Result will only throw an error when something goes really wrong. The Option inside contains the ciphertext of the just inserted value, if this insertion was successful.

pub fn remove(&self, key: &str) -> Result<Option<Value>, DatabaseError>[src]

Remove a value from the database. The wrapping sled::Result will only throw an error when something goes really wrong. The Option inside contains the old value, if one was present.

pub fn keys(&self) -> impl DoubleEndedIterator<Item = Result<IVec>>[src]

Iterate over all keys in the database

pub fn encryption_key(&self) -> &Key[src]

Get encryption key

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.