Ditto 4.5.2
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#include "json.hpp"
8#include <memory>
9#include <vector>
10
11namespace ditto {
12
18 public std::enable_shared_from_this<SyncSubscription> {
19 friend class Sync;
20
21private:
22 SyncSubscription(std::weak_ptr<Ditto::Fields> weak_ditto_fields,
23 std::string query, nlohmann::json args);
24 /* Pointer to the ditto instance */
25 std::weak_ptr<Ditto::Fields> weak_ditto_fields;
26 /* Corresponding query */
27 std::string query;
28 /* Query args stored in cbor format */
29 std::vector<uint8_t> cbor_query_args;
30 /* `Observer` callback */
31 void on_stop();
32
33public:
39 void cancel();
46 bool is_cancelled();
47};
48
49}; // namespace ditto
50#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:18
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
basic_json<> json
default JSON class
Definition json.hpp:2933