Trait HostStoreWithStore
pub trait HostStoreWithStore<T>: HasData + Send {
// Required methods
fn open(
accessor: &Accessor<T, Self>,
label: String,
) -> impl Future<Output = Result<Resource<Store>, Error>> + Send;
fn get(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Option<Vec<u8>>, Error>> + Send;
fn set(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
value: Vec<u8>,
) -> impl Future<Output = Result<(), Error>> + Send;
fn delete(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<(), Error>> + Send;
fn exists(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<bool, Error>> + Send;
fn get_keys(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
) -> impl Future<Output = Result<(StreamReader<String>, FutureReader<Result<(), Error>>), Error>> + Send;
}Required Methods§
fn open(
accessor: &Accessor<T, Self>,
label: String,
) -> impl Future<Output = Result<Resource<Store>, Error>> + Send
fn open( accessor: &Accessor<T, Self>, label: String, ) -> impl Future<Output = Result<Resource<Store>, Error>> + Send
Open the store with the specified label.
label must refer to a store allowed in the spin.toml manifest.
error::no-such-store will be raised if the label is not recognized.
fn get(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Option<Vec<u8>>, Error>> + Send
fn get( accessor: &Accessor<T, Self>, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Option<Vec<u8>>, Error>> + Send
Get the value associated with the specified key
Returns ok(none) if the key does not exist.
fn set(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
value: Vec<u8>,
) -> impl Future<Output = Result<(), Error>> + Send
fn set( accessor: &Accessor<T, Self>, self_: Resource<Store>, key: String, value: Vec<u8>, ) -> impl Future<Output = Result<(), Error>> + Send
Set the value associated with the specified key overwriting any existing value.
fn delete(
accessor: &Accessor<T, Self>,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<(), Error>> + Send
fn delete( accessor: &Accessor<T, Self>, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<(), Error>> + Send
Delete the tuple with the specified key
No error is raised if a tuple did not previously exist for key.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".