1#ifndef DITTO_DITTO_CONFIG_H
2#define DITTO_DITTO_CONFIG_H
49 virtual Type get_type()
const = 0;
58 static std::shared_ptr<Connect>
server(std::string url);
68 static std::shared_ptr<Connect>
84 explicit ServerConnect(std::string url);
86 ServerConnect(
const ServerConnect &other) =
default;
87 ServerConnect(ServerConnect &&other) =
default;
88 ServerConnect &operator=(
const ServerConnect &other) =
default;
89 ServerConnect &operator=(ServerConnect &&other) =
default;
90 ~ServerConnect()
override =
default;
92 Type get_type()
const override;
93 const std::string &get_url()
const;
103 class SmallPeersOnlyConnect :
public Connect {
105 std::string private_key;
108 explicit SmallPeersOnlyConnect(std::string private_key =
"");
110 SmallPeersOnlyConnect(
const SmallPeersOnlyConnect &other) =
default;
111 SmallPeersOnlyConnect(SmallPeersOnlyConnect &&other) =
default;
112 SmallPeersOnlyConnect &
113 operator=(
const SmallPeersOnlyConnect &other) =
default;
114 SmallPeersOnlyConnect &operator=(SmallPeersOnlyConnect &&other) =
default;
115 ~SmallPeersOnlyConnect()
override =
default;
117 Type get_type()
const override;
118 const std::string &get_private_key()
const;
156 void *android_context =
nullptr;
184 DittoConfig &set_android_context(
void *android_context)
noexcept;
245void to_json(nlohmann::json &j, const
DittoConfig &c);
246void from_json(const nlohmann::json &j,
DittoConfig &c);
Specifies how this instance discovers and connects to peers, including network settings and authentic...
Definition DittoConfig.hpp:41
static std::shared_ptr< Connect > server(std::string url)
Factory method to create a server connection.
static std::shared_ptr< Connect > small_peers_only(std::string private_key="")
Factory method to create a small-peers-only connection.
Type
Connection configuration type.
Definition DittoConfig.hpp:46
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
Experimental features configuration.
Definition DittoConfig.hpp:137
std::string passphrase
passphrase for data encryption at rest (empty means no encryption)
Definition DittoConfig.hpp:140
Experimental & set_passphrase(std::string pass) noexcept
Set the passphrase for data encryption at rest.
DittoConfig & set_small_peers_only_connect(std::string private_key="") noexcept
Set the connection configuration to small peers only mode.
DittoConfig & set_experimental(Experimental exp) noexcept
Set the experimental features configuration.
DittoConfig & set_connect(std::shared_ptr< Connect > connect) noexcept
Set the connection configuration.
std::string persistence_directory
the directory that will be used to persist Ditto data
Definition DittoConfig.hpp:160
std::string database_id
The unique identifier for the Ditto instance.
Definition DittoConfig.hpp:127
std::shared_ptr< Connect > connect
Connection configuration for this Ditto instance.
Definition DittoConfig.hpp:132
static std::string default_database_id() noexcept
Returns the default identifier for a Ditto instance.
DittoConfig()=default
Constructor for an empty configuration.
DittoConfig & set_server_connect(std::string url) noexcept
Set the connection configuration to server mode.
static DittoConfig default_config()
Get a usable default configuration.
DittoConfig & set_persistence_directory(std::string persistence_directory) noexcept
Set the directory that will be used to persist Ditto data.
Experimental experimental
Experimental features configuration for this Ditto instance.
Definition DittoConfig.hpp:152
DittoConfig & set_database_id(std::string database_id) noexcept
Set the unique identifier for the Ditto instance.