Struct ockam::LmdbStorage

source ·
pub struct LmdbStorage {
    pub env: Arc<Environment>,
    pub map: Database,
}
Expand description

Storage using the LMDB database

Fields§

§env: Arc<Environment>

lmdb da

§map: Database

lmdb database file

Implementations§

source§

impl LmdbStorage

source

pub async fn new<P>(p: P) -> Result<LmdbStorage, Error>
where P: AsRef<Path>,

Constructor

source

pub async fn write(&self, k: String, v: Vec<u8>) -> Result<(), Error>

Write a new binary value for a given key in the database

source

pub async fn delete(&self, k: String) -> Result<(), Error>

Delete a database entry

Trait Implementations§

source§

impl Clone for LmdbStorage

source§

fn clone(&self) -> LmdbStorage

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LmdbStorage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl PolicyStorage for LmdbStorage

source§

fn get_policy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, r: &'life1 Resource, a: &'life2 Action ) -> Pin<Box<dyn Future<Output = Result<Option<Expr>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, LmdbStorage: 'async_trait,

source§

fn set_policy<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, r: &'life1 Resource, a: &'life2 Action, c: &'life3 Expr ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, LmdbStorage: 'async_trait,

source§

fn del_policy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, r: &'life1 Resource, a: &'life2 Action ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, LmdbStorage: 'async_trait,

source§

fn policies<'life0, 'life1, 'async_trait>( &'life0 self, r: &'life1 Resource ) -> Pin<Box<dyn Future<Output = Result<Vec<(Action, Expr)>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, LmdbStorage: 'async_trait,

source§

impl Storage for LmdbStorage

source§

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, key: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, LmdbStorage: 'async_trait,

Get entry
source§

fn set<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, key: String, val: Vec<u8> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, LmdbStorage: 'async_trait,

Set entry
source§

fn del<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, key: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, LmdbStorage: 'async_trait,

Delete entry
source§

fn keys<'life0, 'life1, 'async_trait>( &'life0 self, namespace: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, LmdbStorage: 'async_trait,

List all keys of a given “type”. TODO: we shouldn’t store different things on a single store.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<D> AsyncTryClone for D
where D: Clone + Sync,

source§

fn async_try_clone<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<D, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, D: 'async_trait,

Try cloning a object and return an Err in case of failure.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more