DittoStore

class DittoStore

Provides access to execute Ditto queries, work with DittoCollections and a write transaction API.

Functions

Link copied to clipboard
fun addReplicationSubscription(query: String, arguments: Map<String, Any>? = null): DittoReplicationSubscription

Installs and returns a replication 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.

Link copied to clipboard
fun collection(name: String): DittoCollection

Returns a DittoCollection with the provided name.

Link copied to clipboard
fun collectionNames(): List<String>

Returns a list of the names of collections in the store.

Link copied to clipboard
fun collections(): DittoPendingCollectionsOperation

Returns an object that lets you fetch or observe the collections in the store.

Link copied to clipboard
fun execute(query: String, arguments: Map<String, Any?> = mapOf()): DittoQueryResult

Executes a DQL query and returns items as a query result.

Link copied to clipboard
operator fun get(name: String): DittoCollection

Returns a DittoCollection with the provided name.

Link copied to clipboard
fun queriesHash(liveQueries: Array<DittoLiveQuery>): BigInteger

Returns a hash representing the current version of the given queries. When a document matching such queries gets mutated, the hash will change as well.

Link copied to clipboard
fun queriesHashMnemonic(liveQueries: Array<DittoLiveQuery>): String

Returns a sequence of English words representing the current version of the given queries. When a document matching such queries gets mutated, the words will change as well.

Link copied to clipboard
fun removeReplicationSubscription(replicationSubscription: DittoReplicationSubscription): Boolean

Removes the given replicationSubscription from the store configuring Ditto to not receive updates for documents matching the corresponding query anymore. No-op if the given replicationSubscription has already been removed.

Link copied to clipboard
fun write(block: (DittoWriteTransaction) -> Unit): List<DittoWriteTransactionResult>
fun write(handler: DittoWriteTransactionHandler): List<DittoWriteTransactionResult>

Allows you to group multiple operations together that affect multiple documents, potentially across multiple collections.

Properties

Link copied to clipboard

All currently active replication subscriptions in the store.