Enum bonsaidb::AnyServerConnection
source · pub enum AnyServerConnection<B: Backend> {
Local(CustomServer<B>),
Networked(AsyncClient),
}
Expand description
A local server or a server over a network connection.
Variants§
Local(CustomServer<B>)
A local server.
Networked(AsyncClient)
A server accessed with an AsyncClient
.
Trait Implementations§
source§impl<B: Backend> AsyncStorageConnection for AnyServerConnection<B>
impl<B: Backend> AsyncStorageConnection for AnyServerConnection<B>
§type Authenticated = AnyServerConnection<B>
type Authenticated = AnyServerConnection<B>
The
StorageConnection
type returned from authentication calls.§type Database = AnyDatabase<B>
type Database = AnyDatabase<B>
The type that represents a database for this implementation.
source§fn admin<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Self::Database> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn admin<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Self::Database> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the currently authenticated session, if any.
source§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,
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns a reference to database
name
with schema DB
.source§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
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§fn delete_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes a database named
name
. Read moresource§fn list_databases<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Database>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_databases<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Database>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists the databases in this storage.
source§fn list_available_schemas<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaSummary>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_available_schemas<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaSummary>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists the
SchemaName
s registered with this storage.source§fn create_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a user.
source§fn delete_user<'user, 'life0, 'async_trait, U>(
&'life0 self,
user: U
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
fn delete_user<'user, 'life0, 'async_trait, U>( &'life0 self, user: U ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
Deletes a user.
source§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>>
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>>
Sets a user’s password.
source§fn authenticate<'life0, 'async_trait>(
&'life0 self,
authentication: Authentication
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate<'life0, 'async_trait>(
&'life0 self,
authentication: Authentication
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Authenticates using an
AuthenticationToken
. If
successful, the returned instance will have the permissions from
identity
.source§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
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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
.source§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>>
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>>
Adds a user to a permission group.
source§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>>
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>>
Removes a user from a permission group.
source§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>>
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>>
Adds a user to a permission group.
source§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>>
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>>
Removes a user from a permission group.
source§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>>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>>where
'life0: 'async_trait,
'life1: 'async_trait,
DB: 'async_trait + Schema,
Self: 'async_trait,
source§fn authenticate_with_token<'life0, 'life1, 'async_trait>(
&'life0 self,
id: u64,
token: &'life1 SensitiveString
) -> Pin<Box<dyn Future<Output = Result<<Self::Authenticated as AsyncStorageConnection>::Authenticated, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn authenticate_with_token<'life0, 'life1, 'async_trait>(
&'life0 self,
id: u64,
token: &'life1 SensitiveString
) -> Pin<Box<dyn Future<Output = Result<<Self::Authenticated as AsyncStorageConnection>::Authenticated, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Authenticates using an
AuthenticationToken
. If
successful, the returned instance will have the permissions from
identity
.source§fn authenticate_with_password<'name, 'life0, 'async_trait, User>(
&'life0 self,
user: User,
password: SensitiveString
) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>>
fn authenticate_with_password<'name, 'life0, 'async_trait, User>( &'life0 self, user: User, password: SensitiveString ) -> Pin<Box<dyn Future<Output = Result<Self::Authenticated, Error>> + Send + 'async_trait>>
Authenticates a
User
using a password. If
successful, the returned instance will have the permissions from
identity
.source§impl<B: Backend> Clone for AnyServerConnection<B>
impl<B: Backend> Clone for AnyServerConnection<B>
source§impl<B: Backend> Debug for AnyServerConnection<B>
impl<B: Backend> Debug for AnyServerConnection<B>
source§impl<B: Backend> HasSession for AnyServerConnection<B>
impl<B: Backend> HasSession for AnyServerConnection<B>
source§fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> bool
fn allowed_to<'a, R, P>(&self, resource_name: R, action: &P) -> bool
Checks if
action
is permitted against resource_name
.source§fn check_permission<'a, R, P>(
&self,
resource_name: R,
action: &P
) -> Result<(), Error>
fn check_permission<'a, R, P>( &self, resource_name: R, action: &P ) -> Result<(), Error>
Checks if
action
is permitted against resource_name
. If permission
is denied, returns a PermissionDenied
error.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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more