pub struct RedisPersistence { /* private fields */ }
Expand description

The MQTT Redis persistence object. An instance of this stuct can be residtered with an MQTT client to hold messgaes in a Redis server until they are properly acknowledged by the remote MQTT server. An instance of this object maps to a single hash on a specific Redis server.

Implementations§

source§

impl RedisPersistence

source

pub fn new() -> Self

Create a new persistence object to connect to a local Redis server.

Trait Implementations§

source§

impl ClientPersistence for RedisPersistence

source§

fn open(&mut self, client_id: &str, server_uri: &str) -> Result<()>

Opena the connection to the Redis client.

source§

fn close(&mut self) -> Result<()>

Close the connection to the Redis client.

source§

fn put(&mut self, key: &str, buffers: Vec<&[u8]>) -> Result<()>

Store a persistent value to Redis. We get a vector of buffer references for the data to store, which we can concatenate into a single byte buffer to send to the server.

source§

fn get(&mut self, key: &str) -> Result<Vec<u8>>

Get the data buffer for the requested key. Although the value sent to the server was a collection of buffers, we can return them as a single, concatenated buffer.

source§

fn remove(&mut self, key: &str) -> Result<()>

Remove the value with the specified key from the store.

source§

fn keys(&mut self) -> Result<Vec<String>>

Return a collection of all the keys in the store for this client.

source§

fn clear(&mut self) -> Result<()>

Remove all the data for this client from the store.

source§

fn contains_key(&mut self, key: &str) -> bool

Determines if the store for this client contains the specified key.

source§

impl Default for RedisPersistence

source§

fn default() -> Self

Create a new persistence object to connect to the Redis server on localhost.

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, 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.