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.
Synchronization of all destinations
Task<DestinationSyncResult[]> StartAsync(bool forceSyncingAll = false);
Parameters |
|
|
forceSyncingAll |
bool |
Determines 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 |
|
|
filename |
string |
The full file name |
destination |
SynchronizationDestination |
The 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/"
});