Ditto 1.1.8
Public Member Functions | Properties | List of all members
DittoSDK.DittoPendingIDSpecificOperation Class Reference

These objects are returned when using DittoCollection.FindById(string) functionality. More...

Public Member Functions

unsafe DittoDocument Exec ()
 Execute the find operation to return the document with the matching ID. More...
 
unsafe bool Remove ()
 Remove the document with the matching ID. More...
 
unsafe bool Evict ()
 Evict the document with the matching ID. More...
 
unsafe List< DittoUpdateResultUpdate (Action< DittoMutableDocument > updater)
 Update the document with the matching ID. More...
 
DittoSubscription Subscribe ()
 Enables you to subscribe to changes that occur in relation to a document remotely. More...
 
DittoLiveQuery Observe (Action< DittoDocument, DittoSingleDocumentLiveQueryEvent > handler)
 Enables you to listen for changes that occur in relation to a document locally and remotely. More...
 
DittoLiveQuery ObserveLocal (Action< DittoDocument, DittoSingleDocumentLiveQueryEvent > handler)
 Enables you to listen for changes that occur in relation to a document locally. More...
 
DittoLiveQuery ObserveWithNextSignal (Action< DittoDocument, DittoSingleDocumentLiveQueryEvent, Action > handler)
 Enables you to listen for changes that occur in relation to a document locally and remotely, and to signal when you are ready for the live query to deliver the next event. More...
 
DittoLiveQuery ObserveLocalWithNextSignal (Action< DittoDocument, DittoSingleDocumentLiveQueryEvent, Action > handler)
 Enables you to listen for changes that occur in relation to a document locally, and to signal when you are ready for the live query to deliver the next event. More...
 

Properties

string Query [get]
 Gets the query associated with this DittoPendingIDSpecificOperation.
 

Detailed Description

These objects are returned when using DittoCollection.FindById(string) functionality.

You can either call Exec on the object to get 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(Action<DittoDocument, DittoSingleDocumentLiveQueryEvent>), will notify you every time there's an update to the document with the ID you provided in the preceding DittoCollection.FindById(string) call.

A subscription, established by calling Subscribe, will act as a signal to other peers that you would like to receive updates from them about the document with the ID you provided in the preceding DittoCollection.FindById(string) call.

Calling Observe(Action<DittoDocument, DittoSingleDocumentLiveQueryEvent>) 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 DittoPendingIDSpecificOperation.ObserveLocal(Action<DittoDocument, DittoSingleDocumentLiveQueryEvent>).

Update, remove, and evict functionality is also exposed through this object.

Member Function Documentation

◆ Evict()

unsafe bool DittoSDK.DittoPendingIDSpecificOperation.Evict ( )
inline

Evict the document with the matching ID.

Returns
true if the document was found and evicted. false if the document wasn't found and therefore wasn't evicted.

◆ Exec()

unsafe DittoDocument DittoSDK.DittoPendingIDSpecificOperation.Exec ( )
inline

Execute the find operation to return the document with the matching ID.

Returns
The DittoDocument with the ID provided in the DittoCollection.FindById(string) call or null if the document was not found.

◆ Observe()

DittoLiveQuery DittoSDK.DittoPendingIDSpecificOperation.Observe ( Action< DittoDocument, DittoSingleDocumentLiveQueryEvent handler)
inline

Enables you to listen for changes that occur in relation to a document locally and remotely.

The handler block will be called when local or remote changes are made to the document referenced by the DittoCollection.FindById(string) call that precedes the call to Observe.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerA block that will be called every time there is a transaction committed to the store that involves a modification to the document with the relevant ID in the collection that Observe was called on.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ ObserveLocal()

DittoLiveQuery DittoSDK.DittoPendingIDSpecificOperation.ObserveLocal ( Action< DittoDocument, DittoSingleDocumentLiveQueryEvent handler)
inline

Enables you to listen for changes that occur in relation to a document locally.

This won't subscribe to receive changes made remotely by others and so it will only fire updates when a local change is made. If you want to receive remotely performed updates as well then use Observe(Action<DittoDocument, DittoSingleDocumentLiveQueryEvent>) or also call Subscribe separately, using another DittoCollection.FindById(string) call that references the same document ID.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerA block that will be called every time there is a transaction committed to the store that involves a modification to the document with the relevant ID in the collection that ObserveLocal was called on.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ ObserveLocalWithNextSignal()

DittoLiveQuery DittoSDK.DittoPendingIDSpecificOperation.ObserveLocalWithNextSignal ( Action< DittoDocument, DittoSingleDocumentLiveQueryEvent, Action >  handler)
inline

Enables you to listen for changes that occur in relation to a document locally, and to signal when you are ready for the live query to deliver the next event.

This won't subscribe to receive changes made remotely by others and so it will only fire updates when a local change is made. If you want to receive remotely performed updates as well then use ObserveWithNextSignal(Action<DittoDocument, DittoSingleDocumentLiveQueryEvent, Action>) or also call Subscribe separately, using another DittoCollection.FindById(string) call that references the same document ID.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerA block that will be called every time there is a transaction committed to the store that involves a modification to the document with the relevant ID in the collection that ObserveLocal was called on.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ ObserveWithNextSignal()

DittoLiveQuery DittoSDK.DittoPendingIDSpecificOperation.ObserveWithNextSignal ( Action< DittoDocument, DittoSingleDocumentLiveQueryEvent, Action >  handler)
inline

Enables you to listen for changes that occur in relation to a document locally and remotely, and to signal when you are ready for the live query to deliver the next event.

The handler block will be called when local or remote changes are made to the document referenced by the DittoCollection.FindById(string) call that precedes the call to Observe.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerA block that will be called every time there is a transaction committed to the store that involves a modification to the document with the relevant ID in the collection that Observe was called on.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ Remove()

unsafe bool DittoSDK.DittoPendingIDSpecificOperation.Remove ( )
inline

Remove the document with the matching ID.

Returns
true if the document was found and removed. false if the document wasn't found and therefore wasn't removed.

◆ Subscribe()

DittoSubscription DittoSDK.DittoPendingIDSpecificOperation.Subscribe ( )
inline

Enables you to subscribe to changes that occur in relation to a document remotely.

Having a subscription acts as a signal to other peers that you are interested in receiving updates when local or remote changes are made to the relevant document.

The returned DittoSubscription object must be kept in scope for as long as you want to keep receiving updates.

Returns
A DittoSubscription object that must be kept in scope for as long as you want to keep receiving updates for the document.

◆ Update()

unsafe List< DittoUpdateResult > DittoSDK.DittoPendingIDSpecificOperation.Update ( Action< DittoMutableDocument updater)
inline

Update the document with the matching ID.

Parameters
updaterAn Action that gets called with the document matching the ID. If found, the document is a DittoMutableDocument, so you can call update-related functions on it. If the document is not found then the value provided to the action will be nil.
Returns
A list of DittoUpdateResult objects that describe the updates that were performed on the document.