Ditto 5.0.0
Loading...
Searching...
No Matches
DittoSDK.Sync.DittoSync Class Reference

Provides access to sync related functionality of Ditto. More...

Inheritance diagram for DittoSDK.Sync.DittoSync:
DittoSDK.Internal.Drop

Public Member Functions

void Start ()
 Starts all network transports.
void Stop ()
 Stops all network transports.
DittoSyncSubscription RegisterSubscription (string query, Dictionary< string, object > arguments=default)
 Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a SELECT query, otherwise a DittoQueryNotSupportedException will be thrown.
DittoSyncSubscription RegisterSubscription (string query, object arguments)
 Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a SELECT query, otherwise a DittoQueryNotSupportedException will be thrown.
Public Member Functions inherited from DittoSDK.Internal.Drop
void Dispose ()
 Suppresses finalization and initiates custom disposal logic.

Protected Member Functions

override void Dispose (bool disposing)
Protected Member Functions inherited from DittoSDK.Internal.Drop
void Dispose (bool disposing)
 Overload for types to dispose of resources, regardless of whether the type is being disposed or finalized. Note that finalization occurs on a dedicated thread.

Properties

IReadOnlyCollection< DittoSyncSubscriptionSubscriptions [get]
 Gets all currently active sync subscriptions.
bool IsActive [get]
 Gets a value indicating whether or not sync is active. Use Start() to activate and Stop() to deactivate sync.
Properties inherited from DittoSDK.Internal.Drop
bool IsDisposed [get]

Detailed Description

Provides access to sync related functionality of Ditto.

Member Function Documentation

◆ RegisterSubscription() [1/2]

DittoSyncSubscription DittoSDK.Sync.DittoSync.RegisterSubscription ( string query,
Dictionary< string, object > arguments = default )
inline

Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a SELECT query, otherwise a DittoQueryNotSupportedException will be thrown.

Parameters
queryA string containing a valid query expressed in DQL.
argumentsA dictionary of values keyed by the placeholder name without the leading :
Example:
new Dictionary<string, object>() { { "mileage" , 123 } }
Returns
An active DittoSyncSubscription for the passed in query and arguments. You'll have to keep it to be able to cancel the sync subscription. Otherwise it will remain active until the owning Ditto object goes out of scope.
Exceptions
DittoStoreExceptionCan throw a DittoStoreException. For more granular exception handling check the following subtypes:

◆ RegisterSubscription() [2/2]

DittoSyncSubscription DittoSDK.Sync.DittoSync.RegisterSubscription ( string query,
object arguments )
inline

Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a SELECT query, otherwise a DittoQueryNotSupportedException will be thrown.

Parameters
queryA string containing a valid query expressed in DQL.
argumentsAn object that serializes to a dictionary of values keyed by the placeholder name without the leading :
Example:
new MyArguments { mileage = 123 }
Returns
An active DittoSyncSubscription for the passed in query and arguments. You'll have to keep it to be able to cancel the sync subscription. Otherwise it will remain active until the owning Ditto object goes out of scope.
Exceptions
DittoStoreExceptionCan throw a DittoStoreException. For more granular exception handling check the following subtypes:

◆ Start()

void DittoSDK.Sync.DittoSync.Start ( )
inline

Starts all network transports.

The default network configuration can be modified via Ditto.TransportConfig

Exceptions
DittoExceptionThrown if the Ditto instance hasn't been activated by a successful call to SetOfflineOnlyLicenseToken.

◆ Stop()

void DittoSDK.Sync.DittoSync.Stop ( )
inline

Stops all network transports.

You may continue to use the Ditto store locally but no data will sync to or from other devices.