C# Class Microsoft.Synchronization.ClientServices.CacheController

Class used for synchronizing an offline cache with a remote sync service.
Datei anzeigen Open project: rafek/SyncFx

Private Properties

Property Type Description
CompleteAsyncWithException void
EnqueueDownloadRequest void
EnqueueUploadRequest void
FireRefreshCompletedEvent void
OnRefreshCancelled void
ProcessCacheRequestCompleted void
RefreshWorker void
RefreshWorkerCompleted void
ResetAsyncWorkerManager void
StartAsyncWorkerManager void

Public Methods

Method Description
CacheController ( Uri serviceUri, string scopeName, Microsoft.Synchronization.ClientServices.OfflineSyncProvider localProvider ) : System

Constructor for CacheController

CancelAsync ( ) : void

Cancels an async operation if the CacheController is in middle of synchronization. This method does nothing if there is no active Refresh in progress.

RefreshAsync ( ) : void

Method that refreshes the Cache by uploading all modified changes and then downloading the server changes.

Private Methods

Method Description
CompleteAsyncWithException ( Exception e ) : void

Complete the uber RefreshAsync request with an optional error if passed.

EnqueueDownloadRequest ( ) : void

Method that performs a download. It gets the server blob anchor from the local provider and then creates an CacheRequest object for that download request. It then passes the processing asynchronously to the underlying CacheRequestHandler.

EnqueueUploadRequest ( ) : void

Method that performs an upload. It gets the ChangeSet from the local provider and then creates an CacheRequest object for that ChangeSet and then passed the processing asynchronously to the underlying CacheRequestHandler.

FireRefreshCompletedEvent ( Exception error, bool wasCancelled ) : void
OnRefreshCancelled ( object state ) : void

Called when the AsyncWorkerManager successfully completes a Cancel WebRequest. This will also be called withing the correct SynchronizationContext and threading context.

ProcessCacheRequestCompleted ( object sender, Microsoft.Synchronization.ClientServices.ProcessCacheRequestCompletedEventArgs e ) : void

Called whenever the CacheRequestHandler proceeses an upload/download request. It is also responsible for issuing another request if it wasnt the last batch. In case of receiving an Upload response it calls the underlying provider with the status of the upload. In case of Download it notifies the local provider of the changes that it needs to save.

RefreshWorker ( Microsoft.Synchronization.ClientServices.AsyncWorkRequest asyncWorker, object inputParams ) : void

Called when a new RefreshAsync is invoked by the user

RefreshWorkerCompleted ( object error ) : void

Called when the Refresh operation is completed. This is guaranteed to be called in the right user SynchronizationContext and thread context

ResetAsyncWorkerManager ( ) : void
StartAsyncWorkerManager ( ) : void

Instantiates a new AsyncWorkerManager object that will be used for the current sync session

Method Details

CacheController() public method

Constructor for CacheController
public CacheController ( Uri serviceUri, string scopeName, Microsoft.Synchronization.ClientServices.OfflineSyncProvider localProvider ) : System
serviceUri System.Uri Remote sync service Uri with a trailing "/" parameter.
scopeName string The scope name being synchronized
localProvider Microsoft.Synchronization.ClientServices.OfflineSyncProvider The OfflineSyncProvider instance for the local store.
return System

CancelAsync() public method

Cancels an async operation if the CacheController is in middle of synchronization. This method does nothing if there is no active Refresh in progress.
public CancelAsync ( ) : void
return void

RefreshAsync() public method

Method that refreshes the Cache by uploading all modified changes and then downloading the server changes.
public RefreshAsync ( ) : void
return void