Ditto 4.14.4
Loading...
Searching...
No Matches
SmallPeerInfo.hpp
1#ifndef DITTO_SMALL_PEER_INFO_H
2#define DITTO_SMALL_PEER_INFO_H
3
4#include "Helpers.hpp"
5#include "json.hpp"
6
7#include <string>
8
9// TODO(v5): remove this using. We don't want `nlohmann::json` to be included
10// in the global namespace for all code that includes this header. (But
11// removing it in v4.x would be a breaking change.) (SDKS-1124)
12using nlohmann::json; // NOLINT(google-global-names-in-headers)
13
14namespace ditto {
15
16class DittoHandleWrapper;
21enum DITTO_DEPRECATED_BECAUSE(
22 "Use Sync Scopes instead, settable via DQL ALTER SYSTEM. Will be removed "
23 "in v5. See: "
24 "https://docs.ditto.live/sdk/latest/sync/sync-scopes") SyncScope {
25 BigPeerOnly,
26 LocalPeerOnly
27};
28
34class SmallPeerInfo {
35private:
36 friend class Ditto;
37 explicit SmallPeerInfo(
38 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
39 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
40
41public:
45 nlohmann::json metadata() const;
56 void set_metadata(nlohmann::json metadata) const;
57
58 /*
59 * @brief Gets the metadata as JSON string.
60 */
61 std::string metadata_json_string() const;
62
73 void set_metadata_json_string(std::string metadata) const;
74
79 bool is_enabled() const;
80
85 void set_enabled(bool enabled) const;
86
96 DITTO_DEPRECATED_BECAUSE(
97 "Use Sync Scopes instead, settable via DQL ALTER SYSTEM. Will be removed "
98 "in v5. See: "
99 "https://docs.ditto.live/sdk/latest/sync/sync-scopes")
101
109 DITTO_DEPRECATED_BECAUSE(
110 "Use Sync Scopes instead, settable via DQL ALTER SYSTEM. Will be removed "
111 "in v5. See: "
112 "https://docs.ditto.live/sdk/latest/sync/sync-scopes")
114};
115} // namespace ditto
116
117#endif
void set_sync_scope(SyncScope sync_scope) const
Sets which "kind" of peers the small peer info will be replicated to.
nlohmann::json metadata() const
Gets the metadata as JSON.
SyncScope sync_scope() const
Gets "kind" of peers the small peer info will be replicated to.
bool is_enabled() const
Gets a value indicating whether small peer info collection is currently enabled. Defaults to true.
void set_metadata_json_string(std::string metadata) const
Sets the metadata as user-provided json string and is inserted into the small peer info system doc at...
void set_enabled(bool enabled) const
Sets a value indicating whether small peer info collection is currently enabled. Defaults to true.
void set_metadata(nlohmann::json metadata) const
Sets the metadata as user-provided json and is inserted into the small peer info system doc at each c...
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
SyncScope
Definition SmallPeerInfo.hpp:24