![]() |
PahoMqttCpp
MQTT C++ Client for POSIX and Windows
|
#include <iclient_persistence.h>
Public Types | |
using | ptr_t = std::shared_ptr<iclient_persistence> |
using | const_ptr_t = std::shared_ptr<const iclient_persistence> |
Public Member Functions | |
virtual | ~iclient_persistence () |
virtual void | open (const string &clientId, const string &serverURI)=0 |
virtual void | close ()=0 |
virtual void | clear ()=0 |
virtual bool | contains_key (const string &key)=0 |
virtual string_collection | keys () const =0 |
virtual void | put (const string &key, const std::vector< string_view > &bufs)=0 |
virtual string | get (const string &key) const =0 |
virtual void | remove (const string &key)=0 |
Friends | |
class | async_client |
class | mock_persistence |
Represents a persistent data store, used to store outbound and inbound messages while they are in flight, enabling delivery to the QoS specified. You can specify an implementation of this interface using client::client(string, string, iclient_persistence), which the client will use to persist QoS 1 and 2 messages.
If the methods defined throw the MqttPersistenceException then the state of the data persisted should remain as prior to the method being called. For example, if put(string, persistable) throws an exception at any point then the data will be assumed to not be in the persistent store. Similarly if remove(string) throws an exception then the data will be assumed to still be held in the persistent store.
It is up to the persistence interface to log any exceptions or error information which may be required when diagnosing a persistence failure.
using mqtt::iclient_persistence::ptr_t = std::shared_ptr<iclient_persistence> |
Smart/shared pointer to an object of this class.
using mqtt::iclient_persistence::const_ptr_t = std::shared_ptr<const iclient_persistence> |
Smart/shared pointer to a const object of this class.
|
inlinevirtual |
Virtual destructor.
|
pure virtual |
Initialize the persistent store. This uses the client ID and server name to create a unique location for the data store.
clientId | The identifier string for the client. |
serverURI | The server to which the client is connected. |
|
pure virtual |
Close the persistent store that was previously opened.
|
pure virtual |
Clears persistence, so that it no longer contains any persisted data.
|
pure virtual |
Returns whether or not data is persisted using the specified key.
key | The key to find |
|
pure virtual |
Returns a collection of keys in this persistent data store.
|
pure virtual |
Puts the specified data into the persistent store.
key | The key. |
bufs | The data to store |
Gets the specified data out of the persistent store.
key | The key |
|
pure virtual |
Remove the data for the specified key.
key | The key |
|
friend |
|
friend |