Ditto 4.5.3
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ditto::Sync Class Reference

Public Member Functions

std::shared_ptr< SyncSubscriptionregister_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.
 

Public Attributes

std::set< std::shared_ptr< SyncSubscription > > subscriptions
 

Member Function Documentation

◆ register_subscription()

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.

Parameters
querya string containing a valid query expressed in DQL.
argumentsa dictionary of values keyed by the placeholder name without the leading :. Example: {{"mileage", 123}}.
Returns
An active 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 Ditto goes out of scope.