Core interfaces

master
Inga 🏳‍🌈 7 years ago
parent ebc68b5fb1
commit 5b19fb1d28
  1. 11
      Source/Contracts/ContentTransformations/IContentEncryptor.cs
  2. 9
      Source/Contracts/ContentTransformations/IContentHasher.cs
  3. 2
      Source/Contracts/EternalArrowBackup.Contracts.csproj
  4. 14
      Source/Contracts/SourceStorage/ISourceDirectory.cs
  5. 13
      Source/Contracts/SourceStorage/ISourceFile.cs
  6. 12
      Source/Contracts/SourceStorage/ISourceStorage.cs
  7. 14
      Source/Contracts/TargetStorage/ITargetDirectory.cs
  8. 18
      Source/Contracts/TargetStorage/ITargetFile.cs
  9. 9
      Source/Contracts/TargetStorage/ITargetStorage.cs
  10. 9
      Source/Contracts/TargetStorage/ITargetStorageForRecovery.cs

@ -0,0 +1,11 @@
namespace EternalArrowBackup.Contracts.Encryption
{
using System.Threading.Tasks;
public interface IContentEncryptor
{
Task<byte[]> Encrypt(byte[] originalData);
Task<byte[]> Decrypt(byte[] encryptedData);
}
}

@ -0,0 +1,9 @@
namespace EternalArrowBackup.Contracts.ContentTransformations
{
using System.Threading.Tasks;
public interface IContentHasher
{
Task<string> ComputeHash(byte[] content);
}
}

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>

@ -0,0 +1,14 @@
namespace EternalArrowBackup.Contracts.SourceStorage
{
using System;
using System.Threading.Tasks;
public interface ISourceDirectory
{
string NormalizedRelativePath { get; }
Task<ISourceFile> GetFile(string filename);
IObservable<ISourceFile> GetAllFiles();
}
}

@ -0,0 +1,13 @@
namespace EternalArrowBackup.Contracts.SourceStorage
{
using System.Threading.Tasks;
public interface ISourceFile
{
string Filename { get; }
long Size { get; }
Task<byte[]> ReadContents();
}
}

@ -0,0 +1,12 @@
namespace EternalArrowBackup.Contracts.SourceStorage
{
using System;
using System.Threading.Tasks;
public interface ISourceStorage
{
Task<ISourceDirectory> GetDirectory(string normalizedRelativePath);
IObservable<ISourceDirectory> GetAllDirectories();
}
}

@ -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<ITargetFile> GetFile(string filename, string hash);
IObservable<ITargetFile> GetAllFiles();
}
}

@ -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<byte[]> RetrieveContents();
}
}

@ -0,0 +1,9 @@
namespace EternalArrowBackup.Contracts.TargetStorage
{
using System.Threading.Tasks;
public interface ITargetStorage
{
Task<ITargetDirectory> GetDirectory(string normalizedRelativePath);
}
}

@ -0,0 +1,9 @@
namespace EternalArrowBackup.Contracts.TargetStorage
{
using System;
public interface ITargetStorageForRecovery
{
IObservable<ITargetDirectory> GetAllDirectories();
}
}
Loading…
Cancel
Save