Struct aries_askar::Session

source ·
pub struct Session(/* private fields */);
Expand description

An active connection to the store backend

Implementations§

source§

impl Session

source

pub async fn count( &mut self, category: Option<&str>, tag_filter: Option<TagFilter> ) -> Result<i64, Error>

Count the number of entries for a given record category

source

pub async fn fetch( &mut self, category: &str, name: &str, for_update: bool ) -> Result<Option<Entry>, Error>

Retrieve the current record at (category, name).

Specify for_update when in a transaction to create an update lock on the associated record, if supported by the store backend

source

pub async fn fetch_all( &mut self, category: Option<&str>, tag_filter: Option<TagFilter>, limit: Option<i64>, for_update: bool ) -> Result<Vec<Entry>, Error>

Retrieve all records matching the given category and tag_filter.

Unlike Store::scan, this method may be used within a transaction. It should not be used for very large result sets due to correspondingly large memory requirements

source

pub async fn insert( &mut self, category: &str, name: &str, value: &[u8], tags: Option<&[EntryTag]>, expiry_ms: Option<i64> ) -> Result<(), Error>

Insert a new record into the store

source

pub async fn remove(&mut self, category: &str, name: &str) -> Result<(), Error>

Remove a record from the store

source

pub async fn replace( &mut self, category: &str, name: &str, value: &[u8], tags: Option<&[EntryTag]>, expiry_ms: Option<i64> ) -> Result<(), Error>

Replace the value and tags of a record in the store

source

pub async fn remove_all( &mut self, category: Option<&str>, tag_filter: Option<TagFilter> ) -> Result<i64, Error>

Remove all records in the store matching a given category and tag_filter

source

pub async fn update( &mut self, operation: EntryOperation, category: &str, name: &str, value: Option<&[u8]>, tags: Option<&[EntryTag]>, expiry_ms: Option<i64> ) -> Result<(), Error>

Perform a record update

This may correspond to an record insert, replace, or remove depending on the provided operation

source

pub async fn insert_key( &mut self, name: &str, key: &LocalKey, metadata: Option<&str>, tags: Option<&[EntryTag]>, expiry_ms: Option<i64> ) -> Result<(), Error>

Insert a local key instance into the store

source

pub async fn fetch_key( &mut self, name: &str, for_update: bool ) -> Result<Option<KeyEntry>, Error>

Fetch an existing key from the store

Specify for_update when in a transaction to create an update lock on the associated record, if supported by the store backend

source

pub async fn fetch_all_keys( &mut self, algorithm: Option<&str>, thumbprint: Option<&str>, tag_filter: Option<TagFilter>, limit: Option<i64>, for_update: bool ) -> Result<Vec<KeyEntry>, Error>

Retrieve all keys matching the given filters.

source

pub async fn remove_key(&mut self, name: &str) -> Result<(), Error>

Remove an existing key from the store

source

pub async fn update_key( &mut self, name: &str, metadata: Option<&str>, tags: Option<&[EntryTag]>, expiry_ms: Option<i64> ) -> Result<(), Error>

Replace the metadata and tags on an existing key in the store

source

pub async fn ping(&mut self) -> Result<(), Error>

Test the connection to the store

source

pub async fn commit(self) -> Result<(), Error>

Commit the pending transaction

source

pub async fn rollback(self) -> Result<(), Error>

Roll back the pending transaction

Trait Implementations§

source§

impl Debug for Session

source§

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

Formats the value using the given formatter. Read more

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<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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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, 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

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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