Ditto 4.5.3
Loading...
Searching...
No Matches
SmallPeerInfo.hpp
1#ifndef DITTO_SMALL_PEER_INFO
2#define DITTO_SMALL_PEER_INFO
3
4#include "json.hpp"
5
6#include <string>
7
9
10namespace ditto {
11
12class DittoHandleWrapper;
13enum SyncScope { BigPeerOnly, LocalPeerOnly };
14
19private:
20 friend class Ditto;
21 SmallPeerInfo(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
22 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
23
24public:
28 json metadata() const;
38 void set_metadata(json metadata) const;
39
40 /*
41 * @brief Gets the metadata as JSON string.
42 */
43 std::string metadata_json_string() const;
44
54 void set_metadata_json_string(std::string metadata) const;
55
56 /*
57 * @brief Gets a value indicating whether small peer info collection is
58 * currently enabled. Defaults to `false`.
59 */
60 bool is_enabled() const;
61 /*
62 * @brief Sets a value indicating whether small peer info collection is
63 * currently enabled. Defaults to `false`.
64 */
65 void set_enabled(bool enabled) const;
66 /*
67 * @brief Gets "kind" of peers the small peer info will be
68 * replicated to.
69 * Default is `SyncScope::LocalPeerOnly`.
70 */
71 SyncScope sync_scope() const;
72 /*
73 * @brief Sets which "kind" of peers the small peer info will be
74 * replicated to.
75 */
76 void set_sync_scope(SyncScope sync_scope) const;
77};
78} // namespace ditto
79
80#endif // !DITTO_SMALL_PEER_INFO
The entrypoint to the Ditto SDK.
Definition Ditto.hpp:32
The entrypoint for small peer user info collection.
Definition SmallPeerInfo.hpp:18
json metadata() const
Gets the metadata as JSON.
Definition SmallPeerInfo.cpp:34
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...
Definition SmallPeerInfo.cpp:46
void set_metadata(json metadata) const
Sets the metadata as user-provided json and is inserted into the small peer info system doc at each c...
Definition SmallPeerInfo.cpp:51
basic_json<> json
default JSON class
Definition json.hpp:2933