pub trait LocalAdminKeyValueStore: WithError + Sized {
type Config: Send + Sync;
// Required methods
fn get_name() -> String;
async fn connect(
config: &Self::Config,
namespace: &str,
) -> Result<Self, Self::Error>;
fn clone_with_root_key(&self, root_key: &[u8]) -> Result<Self, Self::Error>;
async fn list_all(config: &Self::Config) -> Result<Vec<String>, Self::Error>;
async fn list_root_keys(
config: &Self::Config,
namespace: &str,
) -> Result<Vec<Vec<u8>>, Self::Error>;
async fn exists(
config: &Self::Config,
namespace: &str,
) -> Result<bool, Self::Error>;
async fn create(
config: &Self::Config,
namespace: &str,
) -> Result<(), Self::Error>;
async fn delete(
config: &Self::Config,
namespace: &str,
) -> Result<(), Self::Error>;
// Provided methods
fn delete_all(
config: &Self::Config,
) -> impl Future<Output = Result<(), Self::Error>> { ... }
fn maybe_create_and_connect(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Self, Self::Error>> { ... }
fn recreate_and_connect(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Self, Self::Error>> { ... }
}
Expand description
Low-level trait for the administration of stores and their namespaces.
Required Associated Types§
Required Methods§
Sourceasync fn connect(
config: &Self::Config,
namespace: &str,
) -> Result<Self, Self::Error>
async fn connect( config: &Self::Config, namespace: &str, ) -> Result<Self, Self::Error>
Connects to an existing namespace using the given configuration.
Sourcefn clone_with_root_key(&self, root_key: &[u8]) -> Result<Self, Self::Error>
fn clone_with_root_key(&self, root_key: &[u8]) -> Result<Self, Self::Error>
Takes a connection and creates a new one with a different root_key
.
Sourceasync fn list_all(config: &Self::Config) -> Result<Vec<String>, Self::Error>
async fn list_all(config: &Self::Config) -> Result<Vec<String>, Self::Error>
Obtains the list of existing namespaces.
Sourceasync fn list_root_keys(
config: &Self::Config,
namespace: &str,
) -> Result<Vec<Vec<u8>>, Self::Error>
async fn list_root_keys( config: &Self::Config, namespace: &str, ) -> Result<Vec<Vec<u8>>, Self::Error>
Lists the root keys of the namespace. It is possible that some root keys have no keys.
Sourceasync fn exists(
config: &Self::Config,
namespace: &str,
) -> Result<bool, Self::Error>
async fn exists( config: &Self::Config, namespace: &str, ) -> Result<bool, Self::Error>
Tests if a given namespace exists.
Provided Methods§
Sourcefn delete_all(
config: &Self::Config,
) -> impl Future<Output = Result<(), Self::Error>>
fn delete_all( config: &Self::Config, ) -> impl Future<Output = Result<(), Self::Error>>
Deletes all the existing namespaces.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.