24 #ifndef __mqtt_iclient_persistence_h
25 #define __mqtt_iclient_persistence_h
27 #include "MQTTAsync.h"
57 friend class iclient_persistence_test;
60 static int persistence_open(
void** handle,
const char* clientID,
const char* serverURI,
void* context);
61 static int persistence_close(
void* handle);
62 static int persistence_put(
void* handle,
char* key,
int bufcount,
char* buffers[],
int buflens[]);
63 static int persistence_get(
void* handle,
char* key,
char** buffer,
int* buflen);
64 static int persistence_remove(
void* handle,
char* key);
65 static int persistence_keys(
void* handle,
char***
keys,
int* nkeys);
66 static int persistence_clear(
void* handle);
67 static int persistence_containskey(
void* handle,
char* key);
71 using ptr_t = std::shared_ptr<iclient_persistence>;
73 using const_ptr_t = std::shared_ptr<const iclient_persistence>;
86 virtual void open(
const string& clientId,
const string& serverURI) =0;
90 virtual void close() =0;
94 virtual void clear() =0;
111 virtual void put(
const string& key,
const std::vector<string_view>& bufs) =0;
117 virtual string_view get(
const string& key)
const =0;
122 virtual void remove(
const string& key) =0;
135 #endif // __mqtt_iclient_persistence_h
Lightweight client for talking to an MQTT server using non-blocking methods that allow an operation t...
Definition: async_client.h:60
Represents a persistent data store, used to store outbound and inbound messages while they are in fli...
Definition: iclient_persistence.h:54
virtual ~iclient_persistence()
Virtual destructor.
Definition: iclient_persistence.h:78
Basic types and type conversions for the Paho MQTT C++ library.
std::shared_ptr< const iclient_persistence > const_ptr_t
Smart/shared pointer to a const object of this class.
Definition: iclient_persistence.h:73
Buffer reference type for the Paho MQTT C++ library.
Definition of the string_collection class for the Paho MQTT C++ library.
std::shared_ptr< iclient_persistence > ptr_t
Smart/shared pointer to an object of this class.
Definition: iclient_persistence.h:71
Type for a collection of topics.
Definition: string_collection.h:40
virtual void open(const string &clientId, const string &serverURI)=0
Initialize the persistent store.
virtual void clear()=0
Clears persistence, so that it no longer contains any persisted data.
virtual void put(const string &key, const std::vector< string_view > &bufs)=0
Puts the specified data into the persistent store.
virtual void close()=0
Close the persistent store that was previously opened.
A reference to a contiguous sequence of items, with no ownership.
Definition: buffer_view.h:40
virtual bool contains_key(const string &key)=0
Returns whether or not data is persisted using the specified key.
virtual const string_collection & keys() const =0
Returns a collection of keys in this persistent data store.