Ditto 4.13.1
 
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;
20enum DITTO_DEPRECATED_BECAUSE("Will be removed in v5") SyncScope {
21 BigPeerOnly,
22 LocalPeerOnly
23};
24
30class SmallPeerInfo {
31private:
32 friend class Ditto;
33 explicit SmallPeerInfo(
34 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
35 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
36
37public:
41 nlohmann::json metadata() const;
52 void set_metadata(nlohmann::json metadata) const;
53
54 /*
55 * @brief Gets the metadata as JSON string.
56 */
57 std::string metadata_json_string() const;
58
69 void set_metadata_json_string(std::string metadata) const;
70
75 bool is_enabled() const;
76
81 void set_enabled(bool enabled) const;
82
91 DITTO_DEPRECATED_BECAUSE("Will be removed in v5")
93
100 DITTO_DEPRECATED_BECAUSE("Will be removed in v5")
102};
103} // namespace ditto
104
105#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:20