From 5b19fb1d28a842233dbc5c6d4d0ffcc95085a7d3 Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Wed, 12 Jul 2017 16:19:02 +0300 Subject: [PATCH] Core interfaces --- .../IContentEncryptor.cs | 11 +++++++++++ .../ContentTransformations/IContentHasher.cs | 9 +++++++++ .../EternalArrowBackup.Contracts.csproj | 2 +- .../SourceStorage/ISourceDirectory.cs | 14 ++++++++++++++ Source/Contracts/SourceStorage/ISourceFile.cs | 13 +++++++++++++ .../Contracts/SourceStorage/ISourceStorage.cs | 12 ++++++++++++ .../TargetStorage/ITargetDirectory.cs | 14 ++++++++++++++ Source/Contracts/TargetStorage/ITargetFile.cs | 18 ++++++++++++++++++ .../Contracts/TargetStorage/ITargetStorage.cs | 9 +++++++++ .../TargetStorage/ITargetStorageForRecovery.cs | 9 +++++++++ 10 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 Source/Contracts/ContentTransformations/IContentEncryptor.cs create mode 100644 Source/Contracts/ContentTransformations/IContentHasher.cs create mode 100644 Source/Contracts/SourceStorage/ISourceDirectory.cs create mode 100644 Source/Contracts/SourceStorage/ISourceFile.cs create mode 100644 Source/Contracts/SourceStorage/ISourceStorage.cs create mode 100644 Source/Contracts/TargetStorage/ITargetDirectory.cs create mode 100644 Source/Contracts/TargetStorage/ITargetFile.cs create mode 100644 Source/Contracts/TargetStorage/ITargetStorage.cs create mode 100644 Source/Contracts/TargetStorage/ITargetStorageForRecovery.cs diff --git a/Source/Contracts/ContentTransformations/IContentEncryptor.cs b/Source/Contracts/ContentTransformations/IContentEncryptor.cs new file mode 100644 index 0000000..de5e83e --- /dev/null +++ b/Source/Contracts/ContentTransformations/IContentEncryptor.cs @@ -0,0 +1,11 @@ +namespace EternalArrowBackup.Contracts.Encryption +{ + using System.Threading.Tasks; + + public interface IContentEncryptor + { + Task Encrypt(byte[] originalData); + + Task Decrypt(byte[] encryptedData); + } +} diff --git a/Source/Contracts/ContentTransformations/IContentHasher.cs b/Source/Contracts/ContentTransformations/IContentHasher.cs new file mode 100644 index 0000000..2dde010 --- /dev/null +++ b/Source/Contracts/ContentTransformations/IContentHasher.cs @@ -0,0 +1,9 @@ +namespace EternalArrowBackup.Contracts.ContentTransformations +{ + using System.Threading.Tasks; + + public interface IContentHasher + { + Task ComputeHash(byte[] content); + } +} diff --git a/Source/Contracts/EternalArrowBackup.Contracts.csproj b/Source/Contracts/EternalArrowBackup.Contracts.csproj index 954020d..9eca547 100644 --- a/Source/Contracts/EternalArrowBackup.Contracts.csproj +++ b/Source/Contracts/EternalArrowBackup.Contracts.csproj @@ -1,4 +1,4 @@ - + netstandard1.4 diff --git a/Source/Contracts/SourceStorage/ISourceDirectory.cs b/Source/Contracts/SourceStorage/ISourceDirectory.cs new file mode 100644 index 0000000..c109d7f --- /dev/null +++ b/Source/Contracts/SourceStorage/ISourceDirectory.cs @@ -0,0 +1,14 @@ +namespace EternalArrowBackup.Contracts.SourceStorage +{ + using System; + using System.Threading.Tasks; + + public interface ISourceDirectory + { + string NormalizedRelativePath { get; } + + Task GetFile(string filename); + + IObservable GetAllFiles(); + } +} diff --git a/Source/Contracts/SourceStorage/ISourceFile.cs b/Source/Contracts/SourceStorage/ISourceFile.cs new file mode 100644 index 0000000..42c4244 --- /dev/null +++ b/Source/Contracts/SourceStorage/ISourceFile.cs @@ -0,0 +1,13 @@ +namespace EternalArrowBackup.Contracts.SourceStorage +{ + using System.Threading.Tasks; + + public interface ISourceFile + { + string Filename { get; } + + long Size { get; } + + Task ReadContents(); + } +} diff --git a/Source/Contracts/SourceStorage/ISourceStorage.cs b/Source/Contracts/SourceStorage/ISourceStorage.cs new file mode 100644 index 0000000..009d5d6 --- /dev/null +++ b/Source/Contracts/SourceStorage/ISourceStorage.cs @@ -0,0 +1,12 @@ +namespace EternalArrowBackup.Contracts.SourceStorage +{ + using System; + using System.Threading.Tasks; + + public interface ISourceStorage + { + Task GetDirectory(string normalizedRelativePath); + + IObservable GetAllDirectories(); + } +} diff --git a/Source/Contracts/TargetStorage/ITargetDirectory.cs b/Source/Contracts/TargetStorage/ITargetDirectory.cs new file mode 100644 index 0000000..0a0151f --- /dev/null +++ b/Source/Contracts/TargetStorage/ITargetDirectory.cs @@ -0,0 +1,14 @@ +namespace EternalArrowBackup.Contracts.TargetStorage +{ + using System; + using System.Threading.Tasks; + + public interface ITargetDirectory + { + Task UploadFile(string filename, byte[] content, string hash); + + Task GetFile(string filename, string hash); + + IObservable GetAllFiles(); + } +} diff --git a/Source/Contracts/TargetStorage/ITargetFile.cs b/Source/Contracts/TargetStorage/ITargetFile.cs new file mode 100644 index 0000000..c3d4eac --- /dev/null +++ b/Source/Contracts/TargetStorage/ITargetFile.cs @@ -0,0 +1,18 @@ +namespace EternalArrowBackup.Contracts.TargetStorage +{ + using System; + using System.Threading.Tasks; + + public interface ITargetFile + { + string Filename { get; } + + string Hash { get; } + + DateTime UploadDate { get; } + + long Size { get; } + + Task RetrieveContents(); + } +} diff --git a/Source/Contracts/TargetStorage/ITargetStorage.cs b/Source/Contracts/TargetStorage/ITargetStorage.cs new file mode 100644 index 0000000..74fdcef --- /dev/null +++ b/Source/Contracts/TargetStorage/ITargetStorage.cs @@ -0,0 +1,9 @@ +namespace EternalArrowBackup.Contracts.TargetStorage +{ + using System.Threading.Tasks; + + public interface ITargetStorage + { + Task GetDirectory(string normalizedRelativePath); + } +} diff --git a/Source/Contracts/TargetStorage/ITargetStorageForRecovery.cs b/Source/Contracts/TargetStorage/ITargetStorageForRecovery.cs new file mode 100644 index 0000000..61afcee --- /dev/null +++ b/Source/Contracts/TargetStorage/ITargetStorageForRecovery.cs @@ -0,0 +1,9 @@ +namespace EternalArrowBackup.Contracts.TargetStorage +{ + using System; + + public interface ITargetStorageForRecovery + { + IObservable GetAllDirectories(); + } +}