Struct bonsaidb_client::Client
source · [−]Expand description
Client for connecting to a BonsaiDb server.
Implementations
Initialize a client connecting to url. This client can be shared by
cloning it. All requests are done asynchronously over the same
connection.
If the client has an error connecting, the first request made will
present that error. If the client disconnects while processing requests,
all requests being processed will exit and return
Error::Disconnected. The client will automatically try reconnecting.
The goal of this design of this reconnection strategy is to make it easier to build resilliant apps. By allowing existing Client instances to recover and reconnect, each component of the apps built can adopt a “retry-to-recover” design, or “abort-and-fail” depending on how critical the database is to operation.
Sends an api request.
Returns the current effective permissions for the client. Returns None if unauthenticated.
Trait Implementations
type Database = RemoteDatabase<A>
type Database = RemoteDatabase<A>
The type that represents a database for this implementation.
Creates a database named name using the SchemaName schema. Read more
Returns a reference to database name with schema DB.
Deletes a database named name. Read more
Lists the databases in this storage.
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,
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 SchemaNames registered with this storage.
Creates a user.
fn set_user_password<'user, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync>(
&'life0 self,
user: U,
password: SensitiveString
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn set_user_password<'user, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync>(
&'life0 self,
user: U,
password: SensitiveString
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Sets a user’s password.
fn authenticate<'user, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync>(
&'life0 self,
user: U,
authentication: Authentication
) -> Pin<Box<dyn Future<Output = Result<Authenticated, Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn authenticate<'user, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync>(
&'life0 self,
user: U,
authentication: Authentication
) -> Pin<Box<dyn Future<Output = Result<Authenticated, Error>> + Send + 'async_trait>> where
'user: 'async_trait,
U: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Authenticates as a user with a authentication method.
fn add_permission_group_to_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'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,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn add_permission_group_to_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'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,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Adds a user to a permission group.
fn remove_permission_group_from_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'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,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn remove_permission_group_from_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'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,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Removes a user from a permission group.
fn add_role_to_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'life0 self,
user: U,
role: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn add_role_to_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'life0 self,
user: U,
role: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Adds a user to a permission group.
fn remove_role_from_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'life0 self,
user: U,
role: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn remove_role_from_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
&'life0 self,
user: U,
role: G
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'user: 'async_trait,
'group: 'async_trait,
U: 'async_trait,
G: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Removes a user from a permission group.
Creates a database named name with the Schema provided. Read more
Auto Trait Implementations
impl<A = ()> !RefUnwindSafe for Client<A>
impl<A = ()> !UnwindSafe for Client<A>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more