|
Ditto 5.2.0
|
Configuration options for initializing a Ditto instance. More...
Classes | |
| class | Connect |
| Specifies how this instance discovers and connects to peers, including network settings and authentication options. More... | |
| struct | Experimental |
| Experimental features configuration. More... | |
| class | ServerConnect |
| Server connection configuration. More... | |
| class | SmallPeersOnlyConnect |
| Small peers only connection configutation. More... | |
Public Types | |
| using | SystemParameters = std::map< std::string, nlohmann::json > |
| System parameter overrides keyed by parameter name. More... | |
Public Member Functions | |
| DittoConfig ()=default | |
| Constructor for an empty configuration. | |
| DittoConfig (const DittoConfig &other)=default | |
| DittoConfig (DittoConfig &&other)=default | |
| DittoConfig & | operator= (const DittoConfig &other)=default |
| DittoConfig & | operator= (DittoConfig &&other)=default |
| DittoConfig & | set_database_id (std::string database_id) noexcept |
| Set the unique identifier for the Ditto instance. More... | |
| DittoConfig & | set_persistence_directory (std::string persistence_directory) noexcept |
| Set the directory that will be used to persist Ditto data. More... | |
| DittoConfig & | set_connect (std::shared_ptr< Connect > connect) noexcept |
| Set the connection configuration. More... | |
| DittoConfig & | set_server_connect (std::string url) noexcept |
| Set the connection configuration to server mode. More... | |
| DittoConfig & | set_small_peers_only_connect (std::string private_key="") noexcept |
| Set the connection configuration to small peers only mode. More... | |
| DittoConfig & | set_experimental (Experimental exp) noexcept |
| Set the experimental features configuration. More... | |
| DittoConfig & | set_system_parameters (SystemParameters parameters) noexcept |
| Set system parameters to apply when this Ditto instance opens. More... | |
Static Public Member Functions | |
| static DittoConfig | default_config () |
| Get a usable default configuration. More... | |
| static std::string | default_database_id () noexcept |
| Returns the default identifier for a Ditto instance. More... | |
Public Attributes | |
| std::string | database_id |
| The unique identifier for the Ditto instance. More... | |
| std::shared_ptr< Connect > | connect |
| Connection configuration for this Ditto instance. | |
| Experimental | experimental |
| Experimental features configuration for this Ditto instance. | |
| std::string | persistence_directory |
| the directory that will be used to persist Ditto data | |
| SystemParameters | system_parameters |
| System parameters applied when this Ditto instance opens. More... | |
Configuration options for initializing a Ditto instance.
DittoConfig encapsulates all the parameters required to configure a Ditto instance, including identity, connectivity, persistence, and experimental features.
Data members are public, but convenience functions are provided to support builder-style chaining, such as this example:
auto config = DittoConfig::default_config()
.set_database_id("my-app-uuid")
.set_connect(DittoConfig::Connect::server("https://api.ditto.live"))
.set_persistence_directory("/tmp/myapp/persist");
auto ditto = Ditto::open(config);
| using ditto::DittoConfig::SystemParameters = std::map<std::string, nlohmann::json> |
System parameter overrides keyed by parameter name.
A value may be a boolean, string, integer, finite floating-point number, array, or object with string keys. Arrays and objects may recursively contain the same values. Nonnegative integers are encoded as unsigned values. JSON null and binary values are not supported.
The system parameter name and the value expected for that parameter are validated when Ditto opens.
|
static |
Get a usable default configuration.
|
staticnoexcept |
Returns the default identifier for a Ditto instance.
This identifier is used when no explicit ID is provided. It is typically a constant UUID string that ensures a predictable default value. In most cases, you should provide your own unique identifier to avoid conflicts when syncing with other peers.
|
noexcept |
Set the connection configuration.
|
noexcept |
Set the unique identifier for the Ditto instance.
|
noexcept |
Set the experimental features configuration.
|
noexcept |
Set the directory that will be used to persist Ditto data.
|
noexcept |
Set the connection configuration to server mode.
| url | The server URL to connect to |
|
noexcept |
Set the connection configuration to small peers only mode.
| private_key | Optional private key for encryption (empty string means no encryption) |
|
noexcept |
Set system parameters to apply when this Ditto instance opens.
The map and its values are stored by value in this configuration. See SystemParameters for supported value types.
| parameters | A map from system parameter names to values |
| std::string ditto::DittoConfig::database_id |
| SystemParameters ditto::DittoConfig::system_parameters |
System parameters applied when this Ditto instance opens.
See SystemParameters for supported value types. Invalid values cause Ditto::open() to throw.