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 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. | |
| DittoConfig & | set_persistence_directory (std::string persistence_directory) noexcept |
| Set the directory that will be used to persist Ditto data. | |
| DittoConfig & | set_connect (std::shared_ptr< Connect > connect) noexcept |
| Set the connection configuration. | |
| DittoConfig & | set_server_connect (std::string url) noexcept |
| Set the connection configuration to server mode. | |
| 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. | |
Static Public Member Functions | |
| static DittoConfig | default_config () |
| Get a usable default configuration. | |
| static std::string | default_database_id () noexcept |
| Returns the default identifier for a Ditto instance. | |
Public Attributes | |
| std::string | database_id |
| The unique identifier for the Ditto instance. | |
| 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 | |
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);
|
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) |