Interface DittoSync
public interface DittoSync
Provides access to sync related functionality of Ditto.
-
Method Summary
Modifier and TypeMethodDescription@NonNull Set<? extends DittoSyncSubscription> All currently active sync subscriptions.@NonNull DittoSyncSubscriptionregisterSubscription(@NonNull String query) Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query.@NonNull DittoSyncSubscriptionregisterSubscription(@NonNull String query, @Nullable Map<@NonNull String, @NonNull Object> arguments) Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query.
-
Method Details
-
getSubscriptions
@NonNull Set<? extends DittoSyncSubscription> getSubscriptions()All currently active sync subscriptions. -
registerSubscription
Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The givenquerymust be aSELECTquery, otherwise aDittoError.StoreErrorwithDittoError.StoreErrorReason.QueryNotSupportedis thrown.- Parameters:
query- A string containing a valid query expressed in DQL.- Returns:
- An active
DittoSyncSubscriptionfor the givenquerythat can be used to close the subscription. Otherwise, the subscription will remain active until the owningDittoinstance goes out of scope. - Throws:
DittoError- if there is a problem creating or registering the subscription.
-
registerSubscription
@NonNull DittoSyncSubscription registerSubscription(@NonNull String query, @Nullable Map<@NonNull String, @NonNull Object> arguments) throws DittoErrorInstalls and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The givenquerymust be aSELECTquery, otherwise aDittoError.StoreErrorwithDittoError.StoreErrorReason.QueryNotSupportedis thrown.- Parameters:
query- A string containing a valid query expressed in DQL.arguments- An optionalMapof values keyed by the placeholder name without the leading:. Example:["mileage": 123].- Returns:
- An active
DittoSyncSubscriptionfor the givenqueryandargumentsthat can be used to close the subscription. Otherwise, the subscription will remain active until the owningDittoinstance goes out of scope. - Throws:
DittoError- if there is a problem creating or registering the subscription.
-