Ditto 4.8.0
Loading...
Searching...
No Matches
SyncSubscription.hpp
1#ifndef _DITTO_SYNC_SUBSCRIPTION_
2#define _DITTO_SYNC_SUBSCRIPTION_
3
4#include "Ditto.hpp"
5#include "Observer.hpp"
6#include "Sync.hpp"
7
8#include "json.hpp"
9
10#include <memory>
11#include <vector>
12
13namespace ditto {
14
20 public std::enable_shared_from_this<SyncSubscription> {
21 friend class Sync;
22
23private:
24 SyncSubscription(std::weak_ptr<Ditto::Fields> weak_ditto_fields,
25 std::string query, nlohmann::json args);
26 /* Pointer to the ditto instance */
27 std::weak_ptr<Ditto::Fields> weak_ditto_fields;
28 /* Corresponding query */
29 std::string query;
30 /* Query args stored in cbor format */
31 std::vector<uint8_t> cbor_query_args;
32 /* `Observer` callback */
33 void on_stop();
34
35public:
41 void cancel();
48 bool is_cancelled();
49};
50
51}; // namespace ditto
52#endif // !_DITTO_SYNC_SUBSCRIPTION_
An observation token returned by any observation API in the Ditto SDK. Retain this object to continue...
Definition Observer.hpp:11
Definition Sync.hpp:14
A sync subscription configures Ditto to receive updates from remote peers about documents matching th...
Definition SyncSubscription.hpp:20
bool is_cancelled()
Definition SyncSubscription.cpp:48
void cancel()
Cancels the sync subscription so that new changes matching the query are no longer received from othe...
Definition SyncSubscription.cpp:46