public async Task <IEnumerable <S3FileKey> > GetAllKeysAsync(S3FolderKey filter)
        {
            IEnumerable <S3FileKey> response = Enumerable.Empty <S3FileKey>();

            await ExcecuteAsync(async() => response = await _batchRepositoryReader.GetAllKeysAsync(filter), filter);

            return(response);
        }
示例#2
0
        public async Task DeleteAsync(S3FolderKey folderKey)
        {
            if (folderKey == null)
            {
                throw new ArgumentNullException(nameof(folderKey));
            }
            var fileKeys = (await _batchRepositoryReader.GetAllKeysAsync(folderKey)).ToList();

            while (fileKeys.Any())
            {
                var requests = CreateRequests(fileKeys, folderKey);

                var tasks = requests.Select(request => AmazonS3.DeleteObjectsAsync(request));
                await tasks.ThrottleAsync(MaxConcurrentTasks);

                //request for keys again, because sometimes some files are still not deleted
                fileKeys = (await _batchRepositoryReader.GetAllKeysAsync(folderKey)).ToList();
            }
        }
示例#3
0
 public async Task <IEnumerable <S3FileKey> > GetAllKeysAsync(S3FolderKey filter)
 {
     return(await CircuitBreakerPolicy.ExecuteAsync(() =>
                                                    _batchRepositoryReader.GetAllKeysAsync(filter)));
 }