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§
Sourcetype Session: BackendSession + 'static
type Session: BackendSession + 'static
The type of session managed by this backend
Required Methods§
Sourcefn create_profile(
&self,
name: Option<String>,
) -> BoxFuture<'_, Result<String, Error>>
fn create_profile( &self, name: Option<String>, ) -> BoxFuture<'_, Result<String, Error>>
Create a new profile
Sourcefn get_active_profile(&self) -> String
fn get_active_profile(&self) -> String
Get the name of the active profile
Sourcefn get_default_profile(&self) -> BoxFuture<'_, Result<String, Error>>
fn get_default_profile(&self) -> BoxFuture<'_, Result<String, Error>>
Get the name of the default profile
Sourcefn set_default_profile(
&self,
profile: String,
) -> BoxFuture<'_, Result<(), Error>>
fn set_default_profile( &self, profile: String, ) -> BoxFuture<'_, Result<(), Error>>
Set the the default profile
Sourcefn list_profiles(&self) -> BoxFuture<'_, Result<Vec<String>, Error>>
fn list_profiles(&self) -> BoxFuture<'_, Result<Vec<String>, Error>>
Get the details of all store profiles
Sourcefn remove_profile(&self, name: String) -> BoxFuture<'_, Result<bool, Error>>
fn remove_profile(&self, name: String) -> BoxFuture<'_, Result<bool, Error>>
Remove an existing profile
Sourcefn rename_profile(
&self,
from_name: String,
to_name: String,
) -> BoxFuture<'_, Result<bool, Error>>
fn rename_profile( &self, from_name: String, to_name: String, ) -> BoxFuture<'_, Result<bool, Error>>
Change the name of an existing profile
Sourcefn 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 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
Sourcefn session(
&self,
profile: Option<String>,
transaction: bool,
) -> Result<Self::Session, Error>
fn session( &self, profile: Option<String>, transaction: bool, ) -> Result<Self::Session, Error>
Create a new session against the store
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl Backend for AnyBackend
Available on crate feature any only.
impl Backend for AnyBackend
Available on crate feature
any only.type Session = AnyBackendSession
Source§impl Backend for PostgresBackend
Available on crate feature postgres only.
impl Backend for PostgresBackend
Available on crate feature
postgres only.