Struct aries_askar::Session
source · pub struct Session(/* private fields */);
Expand description
An active connection to the store backend
Implementations§
source§impl Session
impl Session
sourcepub async fn count(
&mut self,
category: Option<&str>,
tag_filter: Option<TagFilter>
) -> Result<i64, Error>
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
sourcepub async fn fetch(
&mut self,
category: &str,
name: &str,
for_update: bool
) -> Result<Option<Entry>, Error>
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
sourcepub async fn fetch_all(
&mut self,
category: Option<&str>,
tag_filter: Option<TagFilter>,
limit: Option<i64>,
for_update: bool
) -> Result<Vec<Entry>, Error>
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
sourcepub async fn insert(
&mut self,
category: &str,
name: &str,
value: &[u8],
tags: Option<&[EntryTag]>,
expiry_ms: Option<i64>
) -> Result<(), Error>
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
sourcepub async fn remove(&mut self, category: &str, name: &str) -> Result<(), Error>
pub async fn remove(&mut self, category: &str, name: &str) -> Result<(), Error>
Remove a record from the store
sourcepub async fn replace(
&mut self,
category: &str,
name: &str,
value: &[u8],
tags: Option<&[EntryTag]>,
expiry_ms: Option<i64>
) -> Result<(), Error>
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
sourcepub async fn remove_all(
&mut self,
category: Option<&str>,
tag_filter: Option<TagFilter>
) -> Result<i64, Error>
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
sourcepub async fn update(
&mut self,
operation: EntryOperation,
category: &str,
name: &str,
value: Option<&[u8]>,
tags: Option<&[EntryTag]>,
expiry_ms: Option<i64>
) -> Result<(), Error>
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
sourcepub async fn insert_key(
&mut self,
name: &str,
key: &LocalKey,
metadata: Option<&str>,
tags: Option<&[EntryTag]>,
expiry_ms: Option<i64>
) -> Result<(), Error>
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
sourcepub async fn fetch_key(
&mut self,
name: &str,
for_update: bool
) -> Result<Option<KeyEntry>, Error>
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
sourcepub 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>
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.
sourcepub async fn remove_key(&mut self, name: &str) -> Result<(), Error>
pub async fn remove_key(&mut self, name: &str) -> Result<(), Error>
Remove an existing key from the store