WsClient

Struct WsClient 

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

Implementations§

Source§

impl WsClient

Source

pub async fn new(host: &str, port: u16) -> Result<Self>

Source

pub fn set_state_change_handler( &self, handler: impl Fn(RpcTransportState) + Send + Sync + 'static, )

Sets a callback that will be invoked with the current RpcTransportState whenever the WebSocket connection status changes.

Trait Implementations§

Source§

impl AsyncDataStoreReader for WsClient

Source§

type EntryHandleType = Vec<u8>

Source§

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks whether a key currently exists in the store. Read more
Source§

fn exists_with_key_hash<'life0, 'async_trait>( &'life0 self, _prehashed_key: u64, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks whether a key with a pre-computed hash exists in the store. Read more
Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<Self::EntryHandleType>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves the most recent value associated with a given key. Read more
Source§

fn read_with_key_hash<'life0, 'async_trait>( &'life0 self, _prehashed_key: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Self::EntryHandleType>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the most recent value associated with a pre-computed key hash. Read more
Source§

fn read_last_entry<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<Self::EntryHandleType>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the last entry written to the file. Read more
Source§

fn batch_read<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, keys: &'life1 [&'life2 [u8]], ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self::EntryHandleType>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Reads many keys in one shot. Read more
Source§

fn batch_read_hashed_keys<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _prehashed_keys: &'life1 [u64], _non_hashed_keys: Option<&'life2 [&'life3 [u8]]>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self::EntryHandleType>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Reads many keys in one shot using pre-computed hashes. Read more
Source§

fn read_metadata<'life0, 'life1, 'async_trait>( &'life0 self, _key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<EntryMetadata>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves metadata for a given key. Read more
Source§

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

Counts active (non-deleted) key-value pairs in the storage. Read more
Source§

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

Determines if the store is empty or has no active keys. Read more
Source§

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

Returns the current file size on disk (including those of deleted entries). Read more
Source§

impl AsyncDataStoreWriter for WsClient

Source§

fn write_stream<'life0, 'life1, 'life2, 'async_trait, R>( &'life0 self, _key: &'life1 [u8], _reader: &'life2 mut R, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where R: 'async_trait + Read, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Writes an entry using a streaming Read source (e.g., file, network). Read more
Source§

fn write_stream_with_key_hash<'life0, 'life1, 'async_trait, R>( &'life0 self, _key_hash: u64, _reader: &'life1 mut R, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where R: 'async_trait + Read, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes an entry using a precomputed key hash and a streaming Read source. Read more
Source§

fn write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 [u8], payload: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Writes an entry with a given key and payload. Read more
Source§

fn write_with_key_hash<'life0, 'life1, 'async_trait>( &'life0 self, _key_hash: u64, _payload: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes an entry using a precomputed key hash and a payload. Read more
Source§

fn batch_write<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, entries: &'life1 [(&'life2 [u8], &'life3 [u8])], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Writes multiple key-value pairs as a single transaction. Read more
Source§

fn batch_write_with_key_hashes<'life0, 'life1, 'async_trait>( &'life0 self, _prehashed_keys: Vec<(u64, &'life1 [u8])>, _allow_null_bytes: bool, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes multiple key-value pairs as a single transaction, using precomputed key hashes. Read more
Source§

fn rename<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _old_key: &'life1 [u8], _new_key: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Renames an existing entry by copying it under a new key and marking the old key as deleted. Read more
Source§

fn copy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _key: &'life1 [u8], _target: &'life2 DataStore, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Copies an entry to a different storage container. Read more
Source§

fn transfer<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _key: &'life1 [u8], _target: &'life2 DataStore, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Moves an entry from the current storage to a different storage container. Read more
Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Logically deletes an entry by its key. Read more
Source§

fn batch_delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _keys: &'life1 [&'life2 [u8]], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes a batch of entries from the storage by their keys. Read more
Source§

fn batch_delete_key_hashes<'life0, 'life1, 'async_trait>( &'life0 self, _prehashed_keys: &'life1 [u64], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes a batch of entries from the storage using pre-computed key hashes. Read more

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> 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