示例#1
0
        public async Task UploadMissingFiles(IReadOnlyCollection <FileInfo> filesInfo)
        {
            if (filesInfo is null)
            {
                throw new ArgumentNullException(nameof(filesInfo));
            }

            _log.PutOut($"{filesInfo.Count} files are missing.");
            await _inner.UploadMissingFiles(filesInfo).ConfigureAwait(false);
        }
示例#2
0
        public async Task Synchronize()
        {
            await _synchronizationFunctions.Purge().ConfigureAwait(false);

            var filesInfo = _synchronizationFunctions.GetFilesDictionary();

            foreach (var s3Object in await _synchronizationFunctions.GetObjectsList().ConfigureAwait(false))
            {
                if (filesInfo.TryGetValue(s3Object.Key, out var fileInfo))
                {
                    filesInfo.Remove(s3Object.Key);
                    if (!_synchronizationFunctions.FileEqualsObject(fileInfo, s3Object))
                    {
                        await _synchronizationFunctions.UploadMismatchedFile(fileInfo).ConfigureAwait(false);
                    }
                }
                else
                {
                    await _synchronizationFunctions.DeleteExcessObject(s3Object).ConfigureAwait(false);
                }
            }

            await _synchronizationFunctions.UploadMissingFiles(filesInfo.Values).ConfigureAwait(false);
        }