Interface DittoSync


public interface DittoSync
Provides access to sync related functionality of Ditto.
  • Method Details

    • getSubscriptions

      @NonNull Set<? extends DittoSyncSubscription> getSubscriptions()
      All currently active sync subscriptions.
    • registerSubscription

      @NonNull DittoSyncSubscription registerSubscription(@NonNull String query) throws DittoError
      Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The given query must be a SELECT query, otherwise a DittoError.StoreError with DittoError.StoreErrorReason.QueryNotSupported is thrown.
      Parameters:
      query - A string containing a valid query expressed in DQL.
      Returns:
      An active DittoSyncSubscription for the given query that can be used to close the subscription. Otherwise, the subscription will remain active until the owning Ditto instance 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 DittoError
      Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The given query must be a SELECT query, otherwise a DittoError.StoreError with DittoError.StoreErrorReason.QueryNotSupported is thrown.
      Parameters:
      query - A string containing a valid query expressed in DQL.
      arguments - An optional Map of values keyed by the placeholder name without the leading :. Example: ["mileage": 123].
      Returns:
      An active DittoSyncSubscription for the given query and arguments that can be used to close the subscription. Otherwise, the subscription will remain active until the owning Ditto instance goes out of scope.
      Throws:
      DittoError - if there is a problem creating or registering the subscription.