Updated contracts

master
Inga 🏳‍🌈 7 years ago
parent c5e447308d
commit 197d8a9b93
  1. 4
      Source/Contracts/ContentTransformations/IContentEncryptor.cs
  2. 1
      Source/Contracts/ContentTransformations/IContentHasher.cs
  3. 9
      Source/Contracts/ContentTransformations/IDecryptionResult.cs
  4. 19
      Source/Contracts/TargetStorage/ITargetDirectory.cs

@ -1,4 +1,4 @@
namespace EternalArrowBackup.Contracts.Encryption
namespace EternalArrowBackup.Contracts.ContentTransformations
{
using System.Threading.Tasks;
@ -6,6 +6,6 @@
{
Task<byte[]> Encrypt(byte[] originalData);
Task<byte[]> Decrypt(byte[] encryptedData);
Task<IDecryptionResult> Decrypt(byte[] encryptedData);
}
}

@ -1,5 +1,6 @@
namespace EternalArrowBackup.Contracts.ContentTransformations
{
using System.IO;
using System.Threading.Tasks;
public interface IContentHasher

@ -0,0 +1,9 @@
namespace EternalArrowBackup.Contracts.ContentTransformations
{
public interface IDecryptionResult
{
bool IsSuccessful { get; }
byte[] Data { get; }
}
}

@ -6,24 +6,7 @@
public interface ITargetDirectory
{
/// <summary>
/// Uploads new content to the target directory, and adds new entity with DateTime.UtcNow to the list of files
/// </summary>
/// <param name="filename">File name</param>
/// <param name="content">Content</param>
/// <param name="hash">File hash</param>
/// <returns>Task</returns>
Task UploadNewContent(string filename, byte[] content, string hash);
/// <summary>
/// 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 <see cref="UploadNewContent(string, byte[], string)"/> for v1 and v2, and then call this method (passing v1 FileInfo to it) for v3.
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
Task UpdateExistingContent(ITargetFile file);
Task UploadFile(string filename, byte[] data, string originalHash, long originalSize);
IObservable<ITargetFile> GetAllFiles(CancellationToken ct);
}

Loading…
Cancel
Save