Trait linera_views::store::LocalAdminKeyValueStore
source · pub trait LocalAdminKeyValueStore: WithError + Sized {
type Config: Send + Sync;
// Required methods
fn get_name() -> String;
async fn connect(
config: &Self::Config,
namespace: &str,
root_key: &[u8],
) -> 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,
root_key: &[u8],
) -> impl Future<Output = Result<Self, Self::Error>> { ... }
fn recreate_and_connect(
config: &Self::Config,
namespace: &str,
root_key: &[u8],
) -> 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,
root_key: &[u8],
) -> Result<Self, Self::Error>
async fn connect( config: &Self::Config, namespace: &str, root_key: &[u8], ) -> 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.
Object Safety§
This trait is not object safe.