spin_factor_key_value

Struct KeyValueDispatch

Source
pub struct KeyValueDispatch { /* private fields */ }

Implementations§

Source§

impl KeyValueDispatch

Source

pub fn new( allowed_stores: HashSet<String>, manager: Arc<dyn StoreManager>, ) -> Self

Source

pub fn new_with_capacity( allowed_stores: HashSet<String>, manager: Arc<dyn StoreManager>, capacity: u32, ) -> Self

Source

pub fn get_store<T: 'static>( &self, store: Resource<T>, ) -> Result<&Arc<dyn Store>>

Source

pub fn get_cas<T: 'static>(&self, cas: Resource<T>) -> Result<&Arc<dyn Cas>>

Source

pub fn allowed_stores(&self) -> &HashSet<String>

Source

pub fn get_store_wasi<T: 'static>( &self, store: Resource<T>, ) -> Result<&Arc<dyn Store>, Error>

Source

pub fn get_cas_wasi<T: 'static>( &self, cas: Resource<T>, ) -> Result<&Arc<dyn Cas>, Error>

Trait Implementations§

Source§

impl Host for KeyValueDispatch

Source§

fn open<'life0, 'async_trait>( &'life0 mut self, identifier: String, ) -> Pin<Box<dyn Future<Output = Result<Resource<Bucket>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the bucket with the specified identifier. Read more
Source§

fn convert_error(&mut self, error: Error) -> Result<Error, Error>

Source§

impl Host for KeyValueDispatch

Source§

fn get_many<'life0, 'async_trait>( &'life0 mut self, bucket: Resource<Bucket>, keys: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Option<Vec<u8>>)>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs. Read more
Source§

fn set_many<'life0, 'async_trait>( &'life0 mut self, bucket: Resource<Bucket>, key_values: Vec<(String, Vec<u8>)>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the values associated with the keys in the store. If the key already exists in the store, it overwrites the value. Read more
Source§

fn delete_many<'life0, 'async_trait>( &'life0 mut self, bucket: Resource<Bucket>, keys: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete the key-value pairs associated with the keys in the store. Read more
Source§

impl Host for KeyValueDispatch

Source§

fn increment<'life0, 'async_trait>( &'life0 mut self, bucket: Resource<Bucket>, key: String, delta: i64, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Atomically increment the value associated with the key in the store by the given delta. It returns the new value. Read more
Source§

fn swap<'life0, 'async_trait>( &'life0 mut self, cas_res: Resource<Cas>, value: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Result<(), CasError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if the CAS operation failed.
Source§

impl Host for KeyValueDispatch

Source§

fn open<'life0, 'async_trait>( &'life0 mut self, name: String, ) -> Pin<Box<dyn Future<Output = Result<Result<u32, LegacyError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open the store with the specified name. Read more
Source§

fn get<'life0, 'async_trait>( &'life0 mut self, store: u32, key: String, ) -> Pin<Box<dyn Future<Output = Result<Result<Vec<u8>, LegacyError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the value associated with the specified key from the specified store. Read more
Source§

fn set<'life0, 'async_trait>( &'life0 mut self, store: u32, key: String, value: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Result<(), LegacyError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the value associated with the specified key in the specified store, overwriting any existing value. Read more
Source§

fn delete<'life0, 'async_trait>( &'life0 mut self, store: u32, key: String, ) -> Pin<Box<dyn Future<Output = Result<Result<(), LegacyError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete the tuple with the specified key from the specified store. Read more
Source§

fn exists<'life0, 'async_trait>( &'life0 mut self, store: u32, key: String, ) -> Pin<Box<dyn Future<Output = Result<Result<bool, LegacyError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return whether a tuple exists for the specified key in the specified store. Read more
Source§

fn get_keys<'life0, 'async_trait>( &'life0 mut self, store: u32, ) -> Pin<Box<dyn Future<Output = Result<Result<Vec<String>, LegacyError>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a list of all the keys in the specified store. Read more
Source§

fn close<'life0, 'async_trait>( &'life0 mut self, store: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the specified store. Read more
Source§

impl HostBucket for KeyValueDispatch

Source§

fn get<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Bucket>, key: String, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the value associated with the specified key Read more
Source§

fn set<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Bucket>, key: String, value: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the value associated with the key in the store. If the key already exists in the store, it overwrites the value. Read more
Source§

fn delete<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Bucket>, key: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete the key-value pair associated with the key in the store. Read more
Source§

fn exists<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Bucket>, key: String, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the key exists in the store. Read more
Source§

fn list_keys<'life0, 'async_trait>( &'life0 mut self, self_: Resource<Bucket>, cursor: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<KeyResponse, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all the keys in the store with an optional cursor (for use in pagination). It returns a list of keys. Please note that for most KeyValue implementations, this is a can be a very expensive operation and so it should be used judiciously. Implementations can return any number of keys in a single response, but they should never attempt to send more data than is reasonable (i.e. on a small edge device, this may only be a few KB, while on a large machine this could be several MB). Any response should also return a cursor that can be used to fetch the next page of keys. See the key-response record for more information. Read more
Source§

fn drop<'life0, 'async_trait>( &'life0 mut self, rep: Resource<Bucket>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl HostCas for KeyValueDispatch

Source§

fn new<'life0, 'async_trait>( &'life0 mut self, bucket: Resource<Bucket>, key: String, ) -> Pin<Box<dyn Future<Output = Result<Resource<Cas>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Construct a new CAS operation. Implementors can map the underlying functionality (transactions, versions, etc) as desired.
Source§

fn current<'life0, 'async_trait>( &'life0 mut self, cas: Resource<Cas>, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current value of the key (if it exists). This allows for avoiding reads if all that is needed to ensure the atomicity of the operation
Source§

fn drop<'life0, 'async_trait>( &'life0 mut self, rep: Resource<Cas>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl HostStore for KeyValueDispatch

Source§

fn open<'life0, 'async_trait>( &'life0 mut self, name: String, ) -> Pin<Box<dyn Future<Output = Result<Result<Resource<Store>, Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open the store with the specified label. Read more
Source§

fn get<'life0, 'async_trait>( &'life0 mut self, store: Resource<Store>, key: String, ) -> Pin<Box<dyn Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the value associated with the specified key Read more
Source§

fn set<'life0, 'async_trait>( &'life0 mut self, store: Resource<Store>, key: String, value: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the value associated with the specified key overwriting any existing value.
Source§

fn delete<'life0, 'async_trait>( &'life0 mut self, store: Resource<Store>, key: String, ) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete the tuple with the specified key Read more
Source§

fn exists<'life0, 'async_trait>( &'life0 mut self, store: Resource<Store>, key: String, ) -> Pin<Box<dyn Future<Output = Result<Result<bool, Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return whether a tuple exists for the specified key
Source§

fn get_keys<'life0, 'async_trait>( &'life0 mut self, store: Resource<Store>, ) -> Pin<Box<dyn Future<Output = Result<Result<Vec<String>, Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a list of all the keys
Source§

fn drop<'life0, 'async_trait>( &'life0 mut self, store: Resource<Store>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl Host for KeyValueDispatch

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more