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>,
order_by: Option<OrderBy>,
descending: bool,
for_update: bool,
) -> Result<Vec<Entry>, Error>
pub async fn fetch_all( &mut self, category: Option<&str>, tag_filter: Option<TagFilter>, limit: Option<i64>, order_by: Option<OrderBy>, descending: bool, 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>,
reference: Option<KeyReference>,
tags: Option<&[EntryTag]>,
expiry_ms: Option<i64>,
) -> Result<(), Error>
pub async fn insert_key( &mut self, name: &str, key: &LocalKey, metadata: Option<&str>, reference: Option<KeyReference>, 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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl !Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more