Backend

Trait Backend 

Source
pub trait Backend:
    Debug
    + Send
    + Sync {
    type Session: BackendSession + 'static;

    // Required methods
    fn create_profile(
        &self,
        name: Option<String>,
    ) -> BoxFuture<'_, Result<String, Error>>;
    fn get_active_profile(&self) -> String;
    fn get_default_profile(&self) -> BoxFuture<'_, Result<String, Error>>;
    fn set_default_profile(
        &self,
        profile: String,
    ) -> BoxFuture<'_, Result<(), Error>>;
    fn list_profiles(&self) -> BoxFuture<'_, Result<Vec<String>, Error>>;
    fn remove_profile(&self, name: String) -> BoxFuture<'_, Result<bool, Error>>;
    fn rename_profile(
        &self,
        from_name: String,
        to_name: String,
    ) -> BoxFuture<'_, Result<bool, Error>>;
    fn scan(
        &self,
        profile: Option<String>,
        kind: Option<EntryKind>,
        category: Option<String>,
        tag_filter: Option<TagFilter>,
        offset: Option<i64>,
        limit: Option<i64>,
        order_by: Option<OrderBy>,
        descending: bool,
    ) -> BoxFuture<'_, Result<Scan<'static, Entry>, Error>>;
    fn session(
        &self,
        profile: Option<String>,
        transaction: bool,
    ) -> Result<Self::Session, Error>;
    fn rekey(
        &mut self,
        method: StoreKeyMethod,
        key: PassKey<'_>,
    ) -> BoxFuture<'_, Result<(), Error>>;
    fn close(&self) -> BoxFuture<'_, Result<(), Error>>;
}
Expand description

Represents a generic backend implementation

Required Associated Types§

Source

type Session: BackendSession + 'static

The type of session managed by this backend

Required Methods§

Source

fn create_profile( &self, name: Option<String>, ) -> BoxFuture<'_, Result<String, Error>>

Create a new profile

Source

fn get_active_profile(&self) -> String

Get the name of the active profile

Source

fn get_default_profile(&self) -> BoxFuture<'_, Result<String, Error>>

Get the name of the default profile

Source

fn set_default_profile( &self, profile: String, ) -> BoxFuture<'_, Result<(), Error>>

Set the the default profile

Source

fn list_profiles(&self) -> BoxFuture<'_, Result<Vec<String>, Error>>

Get the details of all store profiles

Source

fn remove_profile(&self, name: String) -> BoxFuture<'_, Result<bool, Error>>

Remove an existing profile

Source

fn rename_profile( &self, from_name: String, to_name: String, ) -> BoxFuture<'_, Result<bool, Error>>

Change the name of an existing profile

Source

fn scan( &self, profile: Option<String>, kind: Option<EntryKind>, category: Option<String>, tag_filter: Option<TagFilter>, offset: Option<i64>, limit: Option<i64>, order_by: Option<OrderBy>, descending: bool, ) -> BoxFuture<'_, Result<Scan<'static, Entry>, Error>>

Create a Scan against the store

Source

fn session( &self, profile: Option<String>, transaction: bool, ) -> Result<Self::Session, Error>

Create a new session against the store

Source

fn rekey( &mut self, method: StoreKeyMethod, key: PassKey<'_>, ) -> BoxFuture<'_, Result<(), Error>>

Replace the wrapping key of the store

Source

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

Close the store instance

Implementors§

Source§

impl Backend for AnyBackend

Available on crate feature any only.
Source§

impl Backend for PostgresBackend

Available on crate feature postgres only.
Source§

type Session = DbSession<Postgres>

Source§

impl Backend for SqliteBackend

Available on crate feature sqlite only.
Source§

type Session = DbSession<Sqlite>