Ditto 3.0.6
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 identifier. More...
 
unsafe bool Remove ()
 Remove the document with the matching identifier. More...
 
unsafe bool Evict ()
 Evict the document with the matching identifier. More...
 
unsafe List< DittoUpdateResultUpdate (Action< DittoMutableDocument > updater)
 Update the document with the matching identifier. More...
 
DittoSubscription Subscribe ()
 Enables you to subscribe to changes that occur in relation to a document remotely. More...
 
DittoLiveQuery ObserveLocal (Action< DittoDocument, DittoSingleDocumentLiveQueryEvent > handler)
 Enables you to listen for changes that occur in relation to a document locally. 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 ObserveLocal(Action<DittoDocument, DittoSingleDocumentLiveQueryEvent>), will notify you every time there's an update to the document with the identifier 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 identifier you provided in the preceding DittoCollection.FindById(string) call.

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 identifier.

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 identifier.

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

◆ 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 call Subscribe separately, using another DittoCollection.FindById(string) call that references the same document identifier.

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 identifier 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 call Subscribe separately, using another DittoCollection.FindById(string) call that references the same document identifier.

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 identifier 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.

◆ Remove()

unsafe bool DittoSDK.DittoPendingIdSpecificOperation.Remove ( )
inline

Remove the document with the matching identifier.

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 identifier.

Parameters
updaterAn Action that gets called with the document matching the identifier. 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.