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 scan(
        &self,
        profile: Option<String>,
        kind: Option<EntryKind>,
        category: Option<String>,
        tag_filter: Option<TagFilter>,
        offset: Option<i64>,
        limit: Option<i64>
    ) -> 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 scan( &self, profile: Option<String>, kind: Option<EntryKind>, category: Option<String>, tag_filter: Option<TagFilter>, offset: Option<i64>, limit: Option<i64> ) -> 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

source§

impl Backend for PostgresBackend

Available on crate feature postgres only.
§

type Session = DbSession<Postgres>

source§

impl Backend for SqliteBackend

Available on crate feature sqlite only.
§

type Session = DbSession<Sqlite>