DittoPendingCollectionsOperation

class DittoPendingCollectionsOperation

These objects are returned when calling collections() on DittoStore.

They allow chaining of further collections-related functions. You can either call exec on the object to get an array of DittoCollections as an immediate return value, or you can establish either a live query or a subscription, which both work over time.

A live query, established by calling observe, will notify you every time there's a change in the collections that the device knows about.

A subscription, established by calling subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about the collections that they know about.

Calling observe will generate both a subscription and a live query at the same time.

If you'd like to only observe local changes then you can call observeLocal.

If you want to observe changes in such a way that you can signal when you're ready for the live query to deliver a new update then you can call observeWithNextSignal or observeLocalWithNextSignal.

Functions

exec
Link copied to clipboard
fun exec(): List<DittoCollection>

Return the list of collections requested based on the preceding function chaining.

limit
Link copied to clipboard
fun limit(limit: Int): DittoPendingCollectionsOperation

Limit the number of collections that get returned.

observe
Link copied to clipboard
fun observe(eventHandler: (DittoCollectionsEvent) -> Unit): DittoLiveQuery
fun observe(callback: DittoCollectionsCallback): DittoLiveQuery

Enables you to listen for changes that occur in relation to the collections that are known about. A block gets called when an update is received either locally or remotely.

observeLocal
Link copied to clipboard
fun observeLocal(eventHandler: (DittoCollectionsEvent) -> Unit): DittoLiveQuery
fun observeLocal(callback: DittoCollectionsCallback): DittoLiveQuery

Enables you to listen for changes that occur in relation to the collections that are known about locally.

observeLocalWithNextSignal
Link copied to clipboard
fun observeLocalWithNextSignal(eventHandler: (DittoCollectionsEvent, DittoSignalNext) -> Unit): DittoLiveQuery

Enables you to listen for changes that occur in relation to the collections that are known about locally. You can signal when you are ready for the next event to be delivered.

Enables you to listen for changes that occur in relation to the collections that are known about. A block gets called when an update is received either locally or remotely. You can signal when you are ready for the next event to be delivered.

observeWithNextSignal
Link copied to clipboard
fun observeWithNextSignal(eventHandler: (DittoCollectionsEvent, DittoSignalNext) -> Unit): DittoLiveQuery

Enables you to listen for changes that occur in relation to the collections that are known about. A block gets called when an update is received either locally or remotely. You can signal when you are ready for the next event to be delivered.

offset
Link copied to clipboard
fun offset(offset: Int): DittoPendingCollectionsOperation

Offset the resulting set of collections.

sort
Link copied to clipboard
fun sort(query: String, direction: DittoSortDirection): DittoPendingCollectionsOperation

Sort the collections based on a property of the collection.

subscribe
Link copied to clipboard
fun subscribe(): DittoSubscription

Subscribes the device to updates about collections that other devices know about.