pub trait AdminKeyValueStore:
WithError
+ Sized
+ Send
+ Sync {
type Config: Send + Sync;
// Required methods
fn get_name() -> String;
fn connect(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync;
fn open_exclusive(&self, root_key: &[u8]) -> Result<Self, Self::Error>;
fn list_all(
config: &Self::Config,
) -> impl Future<Output = Result<Vec<String>, Self::Error>> + Send + Sync;
fn list_root_keys(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + Sync;
fn exists(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync;
fn create(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<(), Self::Error>> + Send + Sync;
fn delete(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<(), Self::Error>> + Send + Sync;
// Provided methods
fn delete_all(
config: &Self::Config,
) -> impl Future<Output = Result<(), Self::Error>> + Send + Sync { ... }
fn maybe_create_and_connect(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync { ... }
fn recreate_and_connect(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync { ... }
}
Expand description
Low-level trait for the administration of stores and their namespaces.
Required Associated Types§
Required Methods§
Sourcefn connect(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync
fn connect( config: &Self::Config, namespace: &str, ) -> impl Future<Output = Result<Self, Self::Error>> + Send + Sync
Connects to an existing namespace using the given configuration.
Sourcefn open_exclusive(&self, root_key: &[u8]) -> Result<Self, Self::Error>
fn open_exclusive(&self, root_key: &[u8]) -> Result<Self, Self::Error>
Opens the key partition starting at root_key
and returns a clone of the
connection to work in this partition.
IMPORTANT: It is assumed that the returned connection is the only user of the partition (for both read and write) and will remain so until it is ended. Future implementations of this method may fail if this is not the case.
Sourcefn list_all(
config: &Self::Config,
) -> impl Future<Output = Result<Vec<String>, Self::Error>> + Send + Sync
fn list_all( config: &Self::Config, ) -> impl Future<Output = Result<Vec<String>, Self::Error>> + Send + Sync
Obtains the list of existing namespaces.
Sourcefn list_root_keys(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + Sync
fn list_root_keys( config: &Self::Config, namespace: &str, ) -> impl Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + Sync
Lists the root keys of the namespace. It is possible that some root keys have no keys.
Sourcefn exists(
config: &Self::Config,
namespace: &str,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync
fn exists( config: &Self::Config, namespace: &str, ) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync
Tests if a given namespace exists.
Provided Methods§
Sourcefn delete_all(
config: &Self::Config,
) -> impl Future<Output = Result<(), Self::Error>> + Send + Sync
fn delete_all( config: &Self::Config, ) -> impl Future<Output = Result<(), Self::Error>> + Send + Sync
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.