public bool EqualETag(S3ObjectInfo s3Object, FileInfo fileInfo, PartSize partSize) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } return(s3Object.ETag == ComputeLocalETag(fileInfo, partSize)); }
public async Task DeleteExcessObject(S3ObjectInfo s3Object) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } _log.PutOut($"Local directory does not contain file {s3Object.Key}."); await _inner.DeleteExcessObject(s3Object).ConfigureAwait(false); }
public async Task DeleteExcessObject(S3ObjectInfo s3Object) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } if (s3Object.LastModified < _options.ThresholdDate) { await _amazonFunctions.DeleteObject(s3Object.Key).ConfigureAwait(false); } }
public bool EqualSize(S3ObjectInfo s3Object, FileInfo fileInfo) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } if (fileInfo is null) { throw new ArgumentNullException(nameof(fileInfo)); } return(s3Object.Size == fileInfo.Length); }
public bool FileEqualsObject(FileInfo fileInfo, S3ObjectInfo s3Object) { if (_comparisonFunctions.EqualSize(s3Object, fileInfo)) { if ((_options.OptionCases & OptionCases.SizeOnly) != OptionCases.SizeOnly) { return(_comparisonFunctions.EqualETag(s3Object, fileInfo, _options.PartSize)); } return(true); } return(false); }
public async Task <IEnumerable <S3ObjectInfo> > GetObjectsList(RemotePath prefix) { if (prefix is null) { throw new ArgumentNullException(nameof(prefix)); } var list = new List <S3ObjectInfo>(); foreach (var obj in await GetS3ObjectsList(prefix).ConfigureAwait(false)) { var objectInfo = new S3ObjectInfo(obj.Key, obj.Size, obj.ETag, obj.LastModified); list.Add(objectInfo); } return(list.AsReadOnly()); }
public bool FileEqualsObject(FileInfo fileInfo, S3ObjectInfo s3Object) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } if (fileInfo is null) { throw new ArgumentNullException(nameof(fileInfo)); } _log.PutOut($"Comparison of file {fileInfo.Name} and S3Object {s3Object.Key} started."); if (_inner.FileEqualsObject(fileInfo, s3Object)) { _log.PutOut($"File {fileInfo.Name} matches object {s3Object.Key}."); return(true); } return(false); }
public bool EqualETag(S3ObjectInfo s3Object, FileInfo fileInfo, PartSize partSize) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } if (fileInfo is null) { throw new ArgumentNullException(nameof(fileInfo)); } if (_inner.EqualETag(s3Object, fileInfo, partSize)) { _log.PutOut($"Hash {s3Object.Key} {fileInfo.Name} matched."); return(true); } _log.PutOut($"File {fileInfo.Name} hash does not match S3Object {s3Object.Key} hash."); return(false); }
public bool EqualSize(S3ObjectInfo s3Object, FileInfo fileInfo) { if (s3Object is null) { throw new ArgumentNullException(nameof(s3Object)); } if (fileInfo is null) { throw new ArgumentNullException(nameof(fileInfo)); } if (_inner.EqualSize(s3Object, fileInfo)) { _log.PutOut($"Size {s3Object.Key} {fileInfo.Name} matched."); return(true); } _log.PutOut($"File {fileInfo.Name} size does not match S3Object {s3Object.Key} size."); return(false); }