Ditto 4.6.0
Loading...
Searching...
No Matches
Sync.hpp
1#ifndef _DITTO_SYNC_
2#define _DITTO_SYNC_
3
4#include "Ditto.hpp"
5
6#include "json.hpp"
7#include <set>
8
9namespace ditto {
10
11class DittoHandleWrapper;
12class SyncSubscription;
13
14class Sync {
15 friend class Ditto;
16 Sync(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
17 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
18 void set_weak_ditto_fields(std::weak_ptr<Ditto::Fields> weak_ditto_fields);
19 std::weak_ptr<Ditto::Fields> weak_ditto_fields;
20
21 friend class SyncSubscription;
26 bool unregister_subscription(std::shared_ptr<SyncSubscription> subscription);
27
28 void remove_subscription(std::shared_ptr<SyncSubscription> subscription);
29
30public:
31 std::set<std::shared_ptr<SyncSubscription>> subscriptions;
47 std::shared_ptr<SyncSubscription>
48 register_subscription(std::string query, nlohmann::json query_args = nullptr);
49};
50
51} // namespace ditto
52
53#endif // !_DITTO_SYNC_
The entrypoint to the Ditto SDK.
Definition Ditto.hpp:32
Definition Sync.hpp:14
std::shared_ptr< SyncSubscription > register_subscription(std::string query, nlohmann::json query_args=nullptr)
Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other...
Definition Sync.cpp:15
A sync subscription configures Ditto to receive updates from remote peers about documents matching th...
Definition SyncSubscription.hpp:18
basic_json<> json
default JSON class
Definition json.hpp:2933