From 197d8a9b93cb0a42bdad3031be300d0eaf401da6 Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Fri, 14 Jul 2017 17:32:11 +0300 Subject: [PATCH] Updated contracts --- .../IContentEncryptor.cs | 4 ++-- .../ContentTransformations/IContentHasher.cs | 1 + .../IDecryptionResult.cs | 9 +++++++++ .../TargetStorage/ITargetDirectory.cs | 19 +------------------ 4 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 Source/Contracts/ContentTransformations/IDecryptionResult.cs diff --git a/Source/Contracts/ContentTransformations/IContentEncryptor.cs b/Source/Contracts/ContentTransformations/IContentEncryptor.cs index de5e83e..41d1dd0 100644 --- a/Source/Contracts/ContentTransformations/IContentEncryptor.cs +++ b/Source/Contracts/ContentTransformations/IContentEncryptor.cs @@ -1,4 +1,4 @@ -namespace EternalArrowBackup.Contracts.Encryption +namespace EternalArrowBackup.Contracts.ContentTransformations { using System.Threading.Tasks; @@ -6,6 +6,6 @@ { Task Encrypt(byte[] originalData); - Task Decrypt(byte[] encryptedData); + Task Decrypt(byte[] encryptedData); } } diff --git a/Source/Contracts/ContentTransformations/IContentHasher.cs b/Source/Contracts/ContentTransformations/IContentHasher.cs index 2dde010..0c255c3 100644 --- a/Source/Contracts/ContentTransformations/IContentHasher.cs +++ b/Source/Contracts/ContentTransformations/IContentHasher.cs @@ -1,5 +1,6 @@ namespace EternalArrowBackup.Contracts.ContentTransformations { + using System.IO; using System.Threading.Tasks; public interface IContentHasher diff --git a/Source/Contracts/ContentTransformations/IDecryptionResult.cs b/Source/Contracts/ContentTransformations/IDecryptionResult.cs new file mode 100644 index 0000000..177397d --- /dev/null +++ b/Source/Contracts/ContentTransformations/IDecryptionResult.cs @@ -0,0 +1,9 @@ +namespace EternalArrowBackup.Contracts.ContentTransformations +{ + public interface IDecryptionResult + { + bool IsSuccessful { get; } + + byte[] Data { get; } + } +} diff --git a/Source/Contracts/TargetStorage/ITargetDirectory.cs b/Source/Contracts/TargetStorage/ITargetDirectory.cs index eb66b82..f0ad6ef 100644 --- a/Source/Contracts/TargetStorage/ITargetDirectory.cs +++ b/Source/Contracts/TargetStorage/ITargetDirectory.cs @@ -6,24 +6,7 @@ public interface ITargetDirectory { - /// - /// Uploads new content to the target directory, and adds new entity with DateTime.UtcNow to the list of files - /// - /// File name - /// Content - /// File hash - /// Task - Task UploadNewContent(string filename, byte[] content, string hash); - - /// - /// Adds new entity with DateTime.UtcNow to the list of files. - /// - /// Example: file "abc.txt" with content "qwe" (v1) was replaced with "rty" (v2), and then was replaced with "qwe" (v3) again. - /// The client should for v1 and v2, and then call this method (passing v1 FileInfo to it) for v3. - /// - /// - /// - Task UpdateExistingContent(ITargetFile file); + Task UploadFile(string filename, byte[] data, string originalHash, long originalSize); IObservable GetAllFiles(CancellationToken ct); }