Skip to main content

BackendSession

Trait BackendSession 

Source
pub trait BackendSession: Debug + Send {
    // Required methods
    fn count<'q>(
        &'q mut self,
        kind: Option<EntryKind>,
        category: Option<&'q str>,
        tag_filter: Option<TagFilter>,
    ) -> BoxFuture<'q, Result<i64, Error>>;
    fn fetch<'q>(
        &'q mut self,
        kind: EntryKind,
        category: &'q str,
        name: &'q str,
        for_update: bool,
    ) -> BoxFuture<'q, Result<Option<Entry>, Error>>;
    fn fetch_all<'q>(
        &'q mut self,
        kind: Option<EntryKind>,
        category: Option<&'q str>,
        tag_filter: Option<TagFilter>,
        limit: Option<i64>,
        order_by: Option<OrderBy>,
        descending: bool,
        for_update: bool,
    ) -> BoxFuture<'q, Result<Vec<Entry>, Error>>;
    fn remove_all<'q>(
        &'q mut self,
        kind: Option<EntryKind>,
        category: Option<&'q str>,
        tag_filter: Option<TagFilter>,
    ) -> BoxFuture<'q, Result<i64, Error>>;
    fn update<'q>(
        &'q mut self,
        kind: EntryKind,
        operation: EntryOperation,
        category: &'q str,
        name: &'q str,
        value: Option<&'q [u8]>,
        tags: Option<&'q [EntryTag]>,
        expiry_ms: Option<i64>,
    ) -> BoxFuture<'q, Result<(), Error>>;
    fn ping(&mut self) -> BoxFuture<'_, Result<(), Error>>;
    fn close(&mut self, commit: bool) -> BoxFuture<'_, Result<(), Error>>;

    // Provided method
    fn import_scan<'q>(
        &'q mut self,
        scan: Scan<'q, Entry>,
    ) -> BoxFuture<'q, Result<(), Error>> { ... }
}
Expand description

Query from a generic backend implementation

Required Methods§

Source

fn count<'q>( &'q mut self, kind: Option<EntryKind>, category: Option<&'q str>, tag_filter: Option<TagFilter>, ) -> BoxFuture<'q, Result<i64, Error>>

Count the number of matching records in the store

Source

fn fetch<'q>( &'q mut self, kind: EntryKind, category: &'q str, name: &'q str, for_update: bool, ) -> BoxFuture<'q, Result<Option<Entry>, Error>>

Fetch a single record from the store by category and name

Source

fn fetch_all<'q>( &'q mut self, kind: Option<EntryKind>, category: Option<&'q str>, tag_filter: Option<TagFilter>, limit: Option<i64>, order_by: Option<OrderBy>, descending: bool, for_update: bool, ) -> BoxFuture<'q, Result<Vec<Entry>, Error>>

Fetch all matching records from the store

Source

fn remove_all<'q>( &'q mut self, kind: Option<EntryKind>, category: Option<&'q str>, tag_filter: Option<TagFilter>, ) -> BoxFuture<'q, Result<i64, Error>>

Remove all matching records from the store

Source

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

Insert or replace a record in the store

Source

fn ping(&mut self) -> BoxFuture<'_, Result<(), Error>>

Test the connection to the store

Source

fn close(&mut self, commit: bool) -> BoxFuture<'_, Result<(), Error>>

Close the current store session

Provided Methods§

Source

fn import_scan<'q>( &'q mut self, scan: Scan<'q, Entry>, ) -> BoxFuture<'q, Result<(), Error>>

Insert scan results from another profile or store

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl BackendSession for AnyBackendSession

Available on crate feature any only.