C# Class Amazon.CognitoSync.SyncManager.Internal.SQLiteLocalStorage

An implementation for Amazon.CognitoSync.SyncManager.ILocalStorage using SQLite
Inheritance: ILocalStorage
Mostra file Open project: aws/aws-sdk-net Class Usage Examples

Public Methods

Method Description
CacheIdentity ( string key, string identity ) : void

cache the identity

ChangeIdentityId ( string oldIdentityId, string newIdentityId ) : void

Reparents all datasets from old identity id to a new one.

ConditionallyPutRecords ( String identityId, String datasetName, List records, List localRecords ) : void

Puts a list of raw records into that dataset if the local version hasn't changed (to be used in synchronizations).

CreateDataset ( string identityId, string datasetName ) : void

Create a dataset

DeleteCachedIdentity ( string key ) : void

Delete the cached identity id

DeleteDataset ( string identityId, string datasetName ) : void

Deletes a dataset. All the records associated with dataset are cleared and dataset is marked as deleted for future sync.

Dispose ( ) : void

Releases the resources consumed by this object

GetDatasetMetadata ( string identityId ) : List

Gets a list of dataset's metadata information.

GetLastSyncCount ( string identityId, string datasetName ) : long

Retrieves the last sync count. This sync count is a counter that represents when the last sync happened. The counter should be updated on a successful sync.

GetModifiedRecords ( string identityId, string datasetName ) : List

Retrieves a list of locally modified records since last successful sync operation.

GetRecord ( string identityId, string datasetName, string key ) : Record

Gets a raw record from local store. If the dataset/key combo doesn't // exist, null will be returned.

GetRecords ( string identityId, string datasetName ) : List

Gets a list of all records.

GetValue ( string identityId, string datasetName, string key ) : string

Retrieves the string value of a key in dataset. The value can be null when the record doesn't exist or is marked as deleted.

GetValueMap ( string identityId, string datasetName ) : string>.Dictionary

Retrieves a key-value map from dataset, excluding marked as deleted values.

PurgeDataset ( string identityId, string datasetName ) : void

This is different from DeleteDataset(String,String). Not only does it clears all records in the dataset, it also remove it from metadata table. It won't be visible in GetDatasetMetadata(String,String).

PutAllValues ( string identityId, string datasetName, string>.IDictionary values ) : void

Puts a key-value map into a dataset. This is optimized for batch operation. It's the preferred way to put a list of records into dataset.

PutRecords ( string identityId, string datasetName, List records ) : void

Puts a list of raw records into dataset.

PutValue ( string identityId, string datasetName, string key, string value ) : void

Puts the value of a key in dataset. If a new value is assigned to the key, the record is marked as dirty. If the value is null, then the record is marked as deleted. The changed record will be synced with remote storage.

SQLiteLocalStorage ( ) : Mono.Data.Sqlite

An implementation for Amazon.CognitoSync.SyncManager.ILocalStorage using SQLite

SQLiteLocalStorage ( ) : System

Creates a new instance of SQLiteLocalStorage

UpdateDatasetMetadata ( string identityId, List datasetMetadata ) : void

Updates local dataset metadata

UpdateLastModifiedTimestamp ( string identityId, string datasetName ) : void

Updates the last modified timestamp

UpdateLastSyncCount ( string identityId, string datasetName, long lastSyncCount ) : void

Updates the last sync count after successful sync with the remote data store.

WipeData ( ) : void

Wipes all locally cached data including dataset metadata and records. All opened dataset handler should not perform further operations to avoid inconsistent state.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Implements the Dispose pattern

Private Methods

Method Description
BindData ( SQLiteCommand command ) : void
BindData ( SQLitePCL.sqlite3_stmt statement ) : void
BindData ( SqliteCommand command ) : void
CreateDatasetHelper ( string query ) : void
DatasetMetadataFromReader ( SqliteDataReader reader ) : DatasetMetadata
DeleteDataset ( string identityId, string datasetName, List additionalStatements ) : void
Execute ( string query ) : void
ExecuteMultipleHelper ( List statements ) : void
ExecuteQuery ( string query ) : SQLitePCL.sqlite3_stmt
GetColumnValue ( SQLitePCL.sqlite3_stmt stmt, Type t, string columnName ) : object
GetCommonDatasetNames ( string oldIdentityId, string newIdentityId ) : HashSet
GetDatasetMetadata ( string identityId, string datasetName ) : DatasetMetadata
GetDatasetMetadataHelper ( string query ) : List
GetIdentity ( string key ) : string
GetLastSyncCountHelper ( string query ) : long
GetMetadataHelper ( string identityId, string datasetName ) : DatasetMetadata
GetModifiedRecordsHelper ( string query ) : List
GetRecordHelper ( string query ) : Record
GetRecordsHelper ( string query ) : List
PutValueHelper ( string identityId, string datasetName, string key, string value ) : bool
RecordFromReader ( SqliteDataReader reader ) : Record
SetupDatabase ( ) : void
SqliteStmtToDatasetMetadata ( SQLiteDataReader reader ) : DatasetMetadata
SqliteStmtToDatasetMetadata ( SQLitePCL.sqlite3_stmt stmt ) : DatasetMetadata
SqliteStmtToRecord ( SQLiteDataReader reader ) : Record
SqliteStmtToRecord ( SQLitePCL.sqlite3_stmt stmt ) : Record
ToUtf8 ( string sText ) : byte[]
UpdateDatasetMetadataInternal ( string identityId, DatasetMetadata metadata ) : bool
UpdateLastModifiedTimestampHelper ( string query ) : void
UpdateLastSyncCountHelper ( string query ) : void
UpdateOrInsertRecord ( string identityId, string datasetName, Record record ) : void

Method Details

CacheIdentity() public method

cache the identity
public CacheIdentity ( string key, string identity ) : void
key string
identity string
return void

ChangeIdentityId() public method

Reparents all datasets from old identity id to a new one.
public ChangeIdentityId ( string oldIdentityId, string newIdentityId ) : void
oldIdentityId string Old identity identifier.
newIdentityId string New identity identifier.
return void

ConditionallyPutRecords() public method

Puts a list of raw records into that dataset if the local version hasn't changed (to be used in synchronizations).
public ConditionallyPutRecords ( String identityId, String datasetName, List records, List localRecords ) : void
identityId String Identity id.
datasetName String Dataset name.
records List A list of remote records to compare with
localRecords List A list of records to check for changes.
return void

CreateDataset() public method

Create a dataset
public CreateDataset ( string identityId, string datasetName ) : void
identityId string Identity Id
datasetName string Dataset name.
return void

DeleteCachedIdentity() public method

Delete the cached identity id
public DeleteCachedIdentity ( string key ) : void
key string
return void

DeleteDataset() public method

Deletes a dataset. All the records associated with dataset are cleared and dataset is marked as deleted for future sync.
public DeleteDataset ( string identityId, string datasetName ) : void
identityId string Identity identifier.
datasetName string Dataset name.
return void

Dispose() public method

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

Dispose() protected method

Implements the Dispose pattern
protected Dispose ( bool disposing ) : void
disposing bool Whether this object is being disposed via a call to Dispose /// or garbage collected.
return void

GetDatasetMetadata() public method

Gets a list of dataset's metadata information.
public GetDatasetMetadata ( string identityId ) : List
identityId string Identity identifier.
return List

GetLastSyncCount() public method

Retrieves the last sync count. This sync count is a counter that represents when the last sync happened. The counter should be updated on a successful sync.
public GetLastSyncCount ( string identityId, string datasetName ) : long
identityId string Identity identifier.
datasetName string Dataset name.
return long

GetModifiedRecords() public method

Retrieves a list of locally modified records since last successful sync operation.
public GetModifiedRecords ( string identityId, string datasetName ) : List
identityId string Identity identifier.
datasetName string Dataset name.
return List

GetRecord() public method

Gets a raw record from local store. If the dataset/key combo doesn't // exist, null will be returned.
public GetRecord ( string identityId, string datasetName, string key ) : Record
identityId string Identity identifier.
datasetName string Dataset name.
key string Key for the record.
return Amazon.CognitoSync.SyncManager.Record

GetRecords() public method

Gets a list of all records.
public GetRecords ( string identityId, string datasetName ) : List
identityId string Identity identifier.
datasetName string Dataset name.
return List

GetValue() public method

Retrieves the string value of a key in dataset. The value can be null when the record doesn't exist or is marked as deleted.
public GetValue ( string identityId, string datasetName, string key ) : string
identityId string Identity identifier.
datasetName string Dataset name.
key string record key.
return string

GetValueMap() public method

Retrieves a key-value map from dataset, excluding marked as deleted values.
public GetValueMap ( string identityId, string datasetName ) : string>.Dictionary
identityId string Identity identifier.
datasetName string Dataset name.
return string>.Dictionary

PurgeDataset() public method

This is different from DeleteDataset(String,String). Not only does it clears all records in the dataset, it also remove it from metadata table. It won't be visible in GetDatasetMetadata(String,String).
public PurgeDataset ( string identityId, string datasetName ) : void
identityId string Identity identifier.
datasetName string Dataset name.
return void

PutAllValues() public method

Puts a key-value map into a dataset. This is optimized for batch operation. It's the preferred way to put a list of records into dataset.
public PutAllValues ( string identityId, string datasetName, string>.IDictionary values ) : void
identityId string Identity identifier.
datasetName string Dataset name.
values string>.IDictionary a key-value map.
return void

PutRecords() public method

Puts a list of raw records into dataset.
public PutRecords ( string identityId, string datasetName, List records ) : void
identityId string Identity identifier.
datasetName string Dataset name.
records List A list of Records.
return void

PutValue() public method

Puts the value of a key in dataset. If a new value is assigned to the key, the record is marked as dirty. If the value is null, then the record is marked as deleted. The changed record will be synced with remote storage.
public PutValue ( string identityId, string datasetName, string key, string value ) : void
identityId string Identity identifier.
datasetName string Dataset name.
key string record key.
value string string value. If null, the record is marked as deleted.
return void

SQLiteLocalStorage() public method

An implementation for Amazon.CognitoSync.SyncManager.ILocalStorage using SQLite
public SQLiteLocalStorage ( ) : Mono.Data.Sqlite
return Mono.Data.Sqlite

SQLiteLocalStorage() public method

Creates a new instance of SQLiteLocalStorage
public SQLiteLocalStorage ( ) : System
return System

UpdateDatasetMetadata() public method

Updates local dataset metadata
public UpdateDatasetMetadata ( string identityId, List datasetMetadata ) : void
identityId string Identity identifier.
datasetMetadata List Dataset metadata.
return void

UpdateLastModifiedTimestamp() public method

Updates the last modified timestamp
public UpdateLastModifiedTimestamp ( string identityId, string datasetName ) : void
identityId string Identity Identifier.
datasetName string Dataset name.
return void

UpdateLastSyncCount() public method

Updates the last sync count after successful sync with the remote data store.
public UpdateLastSyncCount ( string identityId, string datasetName, long lastSyncCount ) : void
identityId string Identity identifier.
datasetName string Dataset name.
lastSyncCount long Last sync count.
return void

WipeData() public method

Wipes all locally cached data including dataset metadata and records. All opened dataset handler should not perform further operations to avoid inconsistent state.
public WipeData ( ) : void
return void