C# Class Amazon.CognitoSync.SyncManager.Dataset

Inheritance: IDisposable
Show file Open project: aws/aws-sdk-net Class Usage Examples

Private Properties

Property Type Description
Dataset Amazon.CognitoIdentity
DatasetSetupInternal void
EndSynchronizeAndCleanup void
HandleNetworkChange void
HandleNetworkChange void
OnNetworkReachabilityChanged void
RunSyncOperation void
RunSyncOperation void
RunSyncOperationAsync System.Threading.Task
SynchronizeHelper void
SynchronizeHelperAsync System.Threading.Task
SynchronizeHelperAsync void

Public Methods

Method Description
Delete ( ) : void

Delete this Amazon.CognitoSync.SyncManager.Dataset. You cannot do any more operations on this dataset.

Dispose ( ) : void

Releases the resources consumed by this object

Get ( string key ) : string

Gets the value of a with the given key. If the Amazon.CognitoSync.SyncManager.Record doesn't exist or is marked deleted, null will be returned.

GetRecord ( string key ) : Record

Gets the Amazon.CognitoSync.SyncManager.Record with the given key. If the Amazon.CognitoSync.SyncManager.Record doesn't exist or is marked deleted, null will be returned.

GetSizeInBytes ( string key ) : long

Gets the size of a record with the given key. If the key is deleted, -1 will be returned. The size is calculated as sum of UTF-8 string length of record key and value

IsModified ( string key ) : bool

Retrieves the status of a record.

Put ( string key, string value ) : void

Puts a Amazon.CognitoSync.SyncManager.Record with the given key and value into the Dataset. If a Amazon.CognitoSync.SyncManager.Record with the same key exists, its value will be overwritten. If a Amazon.CognitoSync.SyncManager.Record is marked as deleted previously, then it will be resurrected with new value while the sync count continues with previous value. No matter whether the value changes or not, the record is considered as updated, and it will be written to Cognito Sync service on next synchronize operation. If value is null, a ArgumentNullException will be thrown.

PutAll ( string>.IDictionary values ) : void

Populates a dataset with a dictionary of key/value pairs

Remove ( string key ) : void

Marks a Amazon.CognitoSync.SyncManager.Record with the given key as deleted. Nothing happens if the Amazon.CognitoSync.SyncManager.Record doesn't exist or is deleted already.

Resolve ( List remoteRecords ) : void

Saves resolved conflicting Amazon.CognitoSync.SyncManager.Record into local storage. This is used inside SyncConflictDelegate after you resolve all conflicts.

Synchronize ( ) : void

Synchronize Dataset between local storage and remote storage.

SynchronizeAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : System.Threading.Task

Synchronize Dataset between local storage and remote storage.

SynchronizeAsync ( AsyncOptions options = null ) : void

Synchronize Dataset between local storage and remote storage.

SynchronizeOnConnectivity ( CancellationToken cancellationToken = default(CancellationToken) ) : System.Threading.Task

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.SynchronizeAsync. Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.

SynchronizeOnConnectivity ( ) : void

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.Synchronize(). Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.

SynchronizeOnConnectivity ( AsyncOptions options = null ) : void

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.SynchronizeAsync(AsyncOptions). Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.

SynchronizeOnConnectivity ( CancellationToken cancellationToken = default(CancellationToken) ) : void

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.SynchronizeAsync. Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the resources consumed by this object if disposing is true.

FireSyncFailureEvent ( Exception exception, AsyncOptions options ) : void

Fires a Sync Failure event.

FireSyncSuccessEvent ( List records, AsyncOptions options ) : void

Fires a Sync Success Event

Private Methods

Method Description
Dataset ( string datasetName, CognitoAWSCredentials cognitoCredentials, ILocalStorage local, CognitoSyncStorage remote ) : Amazon.CognitoIdentity

Creates a new Dataset

DatasetSetupInternal ( ) : void
EndSynchronizeAndCleanup ( ) : void
HandleNetworkChange ( object sender, System.Net.NetworkInformation.NetworkAvailabilityEventArgs e ) : void
HandleNetworkChange ( object sender, NetworkStatusEventArgs e ) : void
OnNetworkReachabilityChanged ( object sender, NetworkStatusEventArgs e ) : void
RunSyncOperation ( int retry ) : void
RunSyncOperation ( int retry, Runtime options ) : void
RunSyncOperationAsync ( int retry, CancellationToken cancellationToken ) : System.Threading.Task
SynchronizeHelper ( ) : void
SynchronizeHelperAsync ( CancellationToken cancellationToken ) : System.Threading.Task
SynchronizeHelperAsync ( AsyncOptions options ) : void

Method Details

Delete() public method

Delete this Amazon.CognitoSync.SyncManager.Dataset. You cannot do any more operations on this dataset.
public Delete ( ) : void
return void

Dispose() public method

Releases the resources consumed by this object
public Dispose ( ) : void
return void

Dispose() protected method

Releases the resources consumed by this object if disposing is true.
protected Dispose ( bool disposing ) : void
disposing bool
return void

FireSyncFailureEvent() protected method

Fires a Sync Failure event.
protected FireSyncFailureEvent ( Exception exception, AsyncOptions options ) : void
exception System.Exception Exception object which caused the sync Failure
options AsyncOptions AsyncOptions object that controls whether
return void

FireSyncSuccessEvent() protected method

Fires a Sync Success Event
protected FireSyncSuccessEvent ( List records, AsyncOptions options ) : void
records List List of records after successful sync
options AsyncOptions AsyncOptions object that controls whether
return void

Get() public method

Gets the value of a with the given key. If the Amazon.CognitoSync.SyncManager.Record doesn't exist or is marked deleted, null will be returned.
public Get ( string key ) : string
key string Key of the record in the dataset.
return string

GetRecord() public method

Gets the Amazon.CognitoSync.SyncManager.Record with the given key. If the Amazon.CognitoSync.SyncManager.Record doesn't exist or is marked deleted, null will be returned.
public GetRecord ( string key ) : Record
key string Key of the record in the dataset.
return Record

GetSizeInBytes() public method

Gets the size of a record with the given key. If the key is deleted, -1 will be returned. The size is calculated as sum of UTF-8 string length of record key and value
public GetSizeInBytes ( string key ) : long
key string The key of a record
return long

IsModified() public method

Retrieves the status of a record.
public IsModified ( string key ) : bool
key string Key identifying a record
return bool

Put() public method

Puts a Amazon.CognitoSync.SyncManager.Record with the given key and value into the Dataset. If a Amazon.CognitoSync.SyncManager.Record with the same key exists, its value will be overwritten. If a Amazon.CognitoSync.SyncManager.Record is marked as deleted previously, then it will be resurrected with new value while the sync count continues with previous value. No matter whether the value changes or not, the record is considered as updated, and it will be written to Cognito Sync service on next synchronize operation. If value is null, a ArgumentNullException will be thrown.
public Put ( string key, string value ) : void
key string Key of the record
value string String value of a to be put into the ///
return void

PutAll() public method

Populates a dataset with a dictionary of key/value pairs
public PutAll ( string>.IDictionary values ) : void
values string>.IDictionary An IDictionary of key/value pairs
return void

Remove() public method

Marks a Amazon.CognitoSync.SyncManager.Record with the given key as deleted. Nothing happens if the Amazon.CognitoSync.SyncManager.Record doesn't exist or is deleted already.
public Remove ( string key ) : void
key string Key identifying the Record
return void

Resolve() public method

Saves resolved conflicting Amazon.CognitoSync.SyncManager.Record into local storage. This is used inside SyncConflictDelegate after you resolve all conflicts.
public Resolve ( List remoteRecords ) : void
remoteRecords List A list of records to save into local storage
return void

Synchronize() public method

Synchronize Dataset between local storage and remote storage.
public Synchronize ( ) : void
return void

SynchronizeAsync() public method

Synchronize Dataset between local storage and remote storage.
public SynchronizeAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : System.Threading.Task
cancellationToken System.Threading.CancellationToken
return System.Threading.Task

SynchronizeAsync() public method

Synchronize Dataset between local storage and remote storage.
public SynchronizeAsync ( AsyncOptions options = null ) : void
options AsyncOptions
return void

SynchronizeOnConnectivity() public method

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.SynchronizeAsync. Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.
public SynchronizeOnConnectivity ( CancellationToken cancellationToken = default(CancellationToken) ) : System.Threading.Task
cancellationToken System.Threading.CancellationToken
return System.Threading.Task

SynchronizeOnConnectivity() public method

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.Synchronize(). Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.
public SynchronizeOnConnectivity ( ) : void
return void

SynchronizeOnConnectivity() public method

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.SynchronizeAsync(AsyncOptions). Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.
public SynchronizeOnConnectivity ( AsyncOptions options = null ) : void
options AsyncOptions
return void

SynchronizeOnConnectivity() public method

Attempt to synchronize Dataset when connectivity is available. If the connectivity is available right away, it behaves the same as Dataset.SynchronizeAsync. Otherwise it listens to connectivity changes, and will do a sync once the connectivity is back. Note that if this method is called multiple times, only the last synchronize request is kept. If either the dataset or the callback is garbage collected , this method will not perform a sync and the callback won't fire.
public SynchronizeOnConnectivity ( CancellationToken cancellationToken = default(CancellationToken) ) : void
cancellationToken System.Threading.CancellationToken
return void