pub trait HostStore: Send {
// Required methods
fn open(
&mut self,
label: String,
) -> impl Future<Output = Result<Result<Resource<Store>, Error>>> + Send;
fn get(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send;
fn set(
&mut self,
self_: Resource<Store>,
key: String,
value: Vec<u8>,
) -> impl Future<Output = Result<Result<(), Error>>> + Send;
fn delete(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<(), Error>>> + Send;
fn exists(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<bool, Error>>> + Send;
fn get_keys(
&mut self,
self_: Resource<Store>,
) -> impl Future<Output = Result<Result<Vec<String>, Error>>> + Send;
fn drop(
&mut self,
rep: Resource<Store>,
) -> impl Future<Output = Result<()>> + Send;
}Required Methods§
Sourcefn open(
&mut self,
label: String,
) -> impl Future<Output = Result<Result<Resource<Store>, Error>>> + Send
fn open( &mut self, label: String, ) -> impl Future<Output = Result<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.
Sourcefn get(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send
fn get( &mut self, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send
Get the value associated with the specified key
Returns ok(none) if the key does not exist.
Sourcefn set(
&mut self,
self_: Resource<Store>,
key: String,
value: Vec<u8>,
) -> impl Future<Output = Result<Result<(), Error>>> + Send
fn set( &mut self, self_: Resource<Store>, key: String, value: Vec<u8>, ) -> impl Future<Output = Result<Result<(), Error>>> + Send
Set the value associated with the specified key overwriting any existing value.
Sourcefn delete(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<(), Error>>> + Send
fn delete( &mut self, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Result<(), Error>>> + Send
Delete the tuple with the specified key
No error is raised if a tuple did not previously exist for key.
Sourcefn exists(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<bool, Error>>> + Send
fn exists( &mut self, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Result<bool, Error>>> + Send
Return whether a tuple exists for the specified key
Sourcefn get_keys(
&mut self,
self_: Resource<Store>,
) -> impl Future<Output = Result<Result<Vec<String>, Error>>> + Send
fn get_keys( &mut self, self_: Resource<Store>, ) -> impl Future<Output = Result<Result<Vec<String>, Error>>> + Send
Return a list of all the keys
fn drop( &mut self, rep: Resource<Store>, ) -> impl Future<Output = Result<()>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<_T: HostStore + ?Sized + Send> HostStore for &mut _T
impl<_T: HostStore + ?Sized + Send> HostStore for &mut _T
Source§fn open(
&mut self,
label: String,
) -> impl Future<Output = Result<Result<Resource<Store>, Error>>> + Send
fn open( &mut self, label: String, ) -> impl Future<Output = Result<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.
Source§fn get(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send
fn get( &mut self, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send
Get the value associated with the specified key
Returns ok(none) if the key does not exist.
Source§fn set(
&mut self,
self_: Resource<Store>,
key: String,
value: Vec<u8>,
) -> impl Future<Output = Result<Result<(), Error>>> + Send
fn set( &mut self, self_: Resource<Store>, key: String, value: Vec<u8>, ) -> impl Future<Output = Result<Result<(), Error>>> + Send
Set the value associated with the specified key overwriting any existing value.
Source§fn delete(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<(), Error>>> + Send
fn delete( &mut self, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Result<(), Error>>> + Send
Delete the tuple with the specified key
No error is raised if a tuple did not previously exist for key.
Source§fn exists(
&mut self,
self_: Resource<Store>,
key: String,
) -> impl Future<Output = Result<Result<bool, Error>>> + Send
fn exists( &mut self, self_: Resource<Store>, key: String, ) -> impl Future<Output = Result<Result<bool, Error>>> + Send
Return whether a tuple exists for the specified key
Source§fn get_keys(
&mut self,
self_: Resource<Store>,
) -> impl Future<Output = Result<Result<Vec<String>, Error>>> + Send
fn get_keys( &mut self, self_: Resource<Store>, ) -> impl Future<Output = Result<Result<Vec<String>, Error>>> + Send
Return a list of all the keys