Skip to main content

Commands: StartAsync

Example

#Commands: StartAsync

The StartAsync method is used to manually force the synchronization to the destinations. It has two overloads that allow you either to synchronize all the files which require that or to synchronize just one specified file.

Task<DestinationSyncResult[]> StartAsync(bool forceSyncingAll = false);
Parameters
forceSyncingAllboolDetermines whether finished synchronization should schedule a next pending one (there can be only a limited number of concurrent synchronizations to a destination file system). The reports of such synchronizations will not be included in DestinationSyncResult object.

Return Value
Task<DestinationSyncResult[]>A task that represents the asynchronous synchronization operation. The task result is an array of DestinationSyncResult object that contains reports about performed operations.

Example

DestinationSyncResult[] results = await store.AsyncFilesCommands.Synchronization
.StartAsync();

var destinationSyncResult in results)
{
WriteLine("Reports of synchronization to server {0}, fs {1}",
tionSyncResult.DestinationServer, destinationSyncResult.DestinationFileSystem);

nationSyncResult.Exception != null)
e;

(var fileReport in destinationSyncResult.Reports)
{
.WriteLine("\tFile {0} synchronization type: {1}", fileReport.FileName, fileReport.Type);
}
}

Synchronization of a particular file to a single file system

Task<SynchronizationReport> StartAsync(string filename, SynchronizationDestination destination);
Parameters
filenamestringThe full file name
destinationSynchronizationDestinationThe destination file system

Return Value
Task<SynchronizationReport>A task that represents the asynchronous file synchronization operation. The task result is a SynchronizationReport.

Example

SynchronizationReport syncReport = await store.AsyncFilesCommands.Synchronization
.StartAsync("/products/pictures/canon_1.jpg",
new SynchronizationDestination
{
FileSystem = "NorthwindFS",
ServerUrl = "http://localhost:8081/"
});