|
Ditto 4.14.6
|
Public Member Functions | |
| Sync (const Sync &other)=default | |
| Sync (Sync &&other)=default | |
| Sync & | operator= (const Sync &other)=default |
| Sync & | operator= (Sync &&other)=default |
| void | start () const |
| Starts the network transports. Ditto will connect to other devices and sync with them where appropriate. | |
| void | stop () const |
| Stops all network transports. | |
| bool | is_active () const |
| Returns a flag indicating whether or not sync is active. Use start to activate sync and stop to deactivate sync. | |
| std::shared_ptr< SyncSubscription > | register_subscription (std::string query, nlohmann::json query_args=nullptr) |
Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The provided query must be a SELECT query. | |
| std::set< std::shared_ptr< SyncSubscription > > | get_subscriptions () const |
| Returns a snapshot of all active subscriptions. | |
Public Attributes | |
| std::set< std::shared_ptr< SyncSubscription > > | subscriptions |
| Set of active subscriptions. | |
| bool ditto::Sync::is_active | ( | ) | const |
| std::shared_ptr< SyncSubscription > ditto::Sync::register_subscription | ( | std::string | query, |
| nlohmann::json | query_args = nullptr |
||
| ) |
Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The provided query must be a SELECT query.
| query | a string containing a valid query expressed in DQL. |
| arguments | a dictionary of values keyed by the placeholder name without the leading :. Example: {{"mileage", 123}}. |
SyncSubscription for the provided query and arguments. You'll have to keep it to be able to cancel the replication subscription, i.e. remove it from the store again. Otherwise it will remain active until the Ditto instance goes out of scope. | void ditto::Sync::start | ( | ) | const |
Starts the network transports. Ditto will connect to other devices and sync with them where appropriate.
By default Ditto will enable all peer-to-peer transport types. The default network configuration can be modified with update_transport_config or replaced with set_transport_config.
| DittoError | thrown if the Ditto instance hasn't been activated by a successful call to set_offline_only_license_token. |
| void ditto::Sync::stop | ( | ) | const |
Stops all network transports.
You may continue to use the Ditto store locally but no data will sync to or from other devices.
| std::set<std::shared_ptr<SyncSubscription> > ditto::Sync::subscriptions |
Set of active subscriptions.
This member should not be accessed by client code. Its contents are managed by the owning Sync instance and will be mutated whenever a subscription is created, canceled, or destroyed.