Enum bonsaidb::AnyServerConnection
source · [−]pub enum AnyServerConnection<B: Backend> {
Local(CustomServer<B>),
Networked(Client),
}
Expand description
A local server or a server over a network connection.
Variants
Local(CustomServer<B>)
A local server.
Networked(Client)
A server accessed with a Client
.
Trait Implementations
sourceimpl<B: Backend> AsyncStorageConnection for AnyServerConnection<B>
impl<B: Backend> AsyncStorageConnection for AnyServerConnection<B>
type Database = AnyDatabase<B>
type Database = AnyDatabase<B>
The type that represents a database for this implementation.
type Authenticated = Self
type Authenticated = Self
The StorageConnection
type returned from authentication calls.
sourcefn admin<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Self::Database> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn admin<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Self::Database> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Returns the currently authenticated session, if any.
sourcefn database<'life0, 'life1, 'async_trait, DB>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self::Database, Error>> + Send + 'async_trait>> where
DB: 'async_trait + Schema,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn database<'life0, 'life1, 'async_trait, DB>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self::Database, Error>> + Send + 'async_trait>> where
DB: 'async_trait + Schema,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns a reference to database name
with schema DB
.
sourcefn create_database_with_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
schema: SchemaName,
only_if_needed: bool
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn create_database_with_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
schema: SchemaName,
only_if_needed: bool
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Creates a database named name
using the SchemaName
schema
. Read more
sourcefn delete_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Deletes a database named name
. Read more
sourcefn list_databases<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Database>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn list_databases<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Database>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Lists the databases in this storage.
sourcefn list_available_schemas<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaName>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn list_available_schemas<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaName>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Lists the SchemaName
s registered with this storage.
sourcefn create_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn create_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Creates a user.
sourcefn delete_user<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn delete_user<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Deletes a user.
sourcefn set_user_password<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U,
password: SensitiveString
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn set_user_password<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U,
password: SensitiveString
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Sets a user’s password.
sourcefn authenticate<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U,
authentication: Authentication
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn authenticate<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U,
authentication: Authentication
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Authenticates as a user with a authentication method.
sourcefn assume_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
identity: IdentityReference<'life1>
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn assume_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
identity: IdentityReference<'life1>
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Assumes the identity
. If successful, the returned instance will have
the merged permissions of the current authentication session and the
permissions from identity
. Read more
sourcefn add_permission_group_to_user<'user, 'group, 'life0, 'async_trait, U, G>(
&'life0 self,
user: U,
permission_group: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
G: 'async_trait + Nameable<'group, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn add_permission_group_to_user<'user, 'group, 'life0, 'async_trait, U, G>(
&'life0 self,
user: U,
permission_group: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
G: 'async_trait + Nameable<'group, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Adds a user to a permission group.
sourcefn remove_permission_group_from_user<'user, 'group, 'life0, 'async_trait, U, G>(
&'life0 self,
user: U,
permission_group: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
G: 'async_trait + Nameable<'group, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn remove_permission_group_from_user<'user, 'group, 'life0, 'async_trait, U, G>(
&'life0 self,
user: U,
permission_group: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
G: 'async_trait + Nameable<'group, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Removes a user from a permission group.
sourcefn add_role_to_user<'user, 'role, 'life0, 'async_trait, U, R>(
&'life0 self,
user: U,
role: R
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'role: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
R: 'async_trait + Nameable<'role, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn add_role_to_user<'user, 'role, 'life0, 'async_trait, U, R>(
&'life0 self,
user: U,
role: R
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'role: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
R: 'async_trait + Nameable<'role, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Adds a user to a permission group.
sourcefn remove_role_from_user<'user, 'role, 'life0, 'async_trait, U, R>(
&'life0 self,
user: U,
role: R
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'role: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
R: 'async_trait + Nameable<'role, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
fn remove_role_from_user<'user, 'role, 'life0, 'async_trait, U, R>(
&'life0 self,
user: U,
role: R
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'role: 'async_trait,
U: 'async_trait + Nameable<'user, u64> + Send + Sync,
R: 'async_trait + Nameable<'role, u64> + Send + Sync,
'life0: 'async_trait,
Self: 'async_trait,
Removes a user from a permission group.
sourcefn create_database<'life0, 'life1, 'async_trait, DB>(
&'life0 self,
name: &'life1 str,
only_if_needed: bool
) -> Pin<Box<dyn Future<Output = Result<Self::Database, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
DB: 'async_trait + Schema,
Self: 'async_trait,
fn create_database<'life0, 'life1, 'async_trait, DB>(
&'life0 self,
name: &'life1 str,
only_if_needed: bool
) -> Pin<Box<dyn Future<Output = Result<Self::Database, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
DB: 'async_trait + Schema,
Self: 'async_trait,
Creates a database named name
with the Schema
provided. Read more
sourceimpl<B: Backend> HasSession for AnyServerConnection<B>
impl<B: Backend> HasSession for AnyServerConnection<B>
sourcefn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> bool where
R: AsRef<[Identifier<'a>]>,
P: Action,
fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> bool where
R: AsRef<[Identifier<'a>]>,
P: Action,
Checks if action
is permitted against resource_name
.
sourcefn check_permission<'a, R, P>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error> where
R: AsRef<[Identifier<'a>]>,
P: Action,
fn check_permission<'a, R, P>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error> where
R: AsRef<[Identifier<'a>]>,
P: Action,
Checks if action
is permitted against resource_name
. If permission
is denied, returns a PermissionDenied
error. Read more
Auto Trait Implementations
impl<B> !RefUnwindSafe for AnyServerConnection<B>
impl<B> Send for AnyServerConnection<B>
impl<B> Sync for AnyServerConnection<B>
impl<B> Unpin for AnyServerConnection<B>
impl<B> !UnwindSafe for AnyServerConnection<B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more