diff options
author | Tyler Gill <tyler.gill@byu.net> | 2017-09-25 02:30:52 +0300 |
---|---|---|
committer | Tyler Gill <tyler.gill@byu.net> | 2017-09-25 02:30:52 +0300 |
commit | b4f56750f8515d803d7924a0e1a809e139fdba4f (patch) | |
tree | c4d311e7824c138b12c83f04478b10397a2a4cec /Duplicati/Library/Interface | |
parent | 6c921ab3ec878a99262150b80b7f29713700c11e (diff) |
Add IQuotaInfo interface
It also makes quota enabled backends return an instance of this interface instead of the quota components separately.
This way, getting quota stats requires only a single remote request on backends like Google Drive and OneDrive.
Diffstat (limited to 'Duplicati/Library/Interface')
-rw-r--r-- | Duplicati/Library/Interface/Duplicati.Library.Interface.csproj | 2 | ||||
-rw-r--r-- | Duplicati/Library/Interface/IQuotaEnabledBackend.cs | 14 | ||||
-rw-r--r-- | Duplicati/Library/Interface/IQuotaInfo.cs | 24 | ||||
-rw-r--r-- | Duplicati/Library/Interface/QuotaInfo.cs | 21 |
4 files changed, 51 insertions, 10 deletions
diff --git a/Duplicati/Library/Interface/Duplicati.Library.Interface.csproj b/Duplicati/Library/Interface/Duplicati.Library.Interface.csproj index 5a2b82a5c..cde93b6aa 100644 --- a/Duplicati/Library/Interface/Duplicati.Library.Interface.csproj +++ b/Duplicati/Library/Interface/Duplicati.Library.Interface.csproj @@ -54,9 +54,11 @@ <Compile Include="IGenericSourceModule.cs" />
<Compile Include="IGenericModule.cs" />
<Compile Include="IQuotaEnabledBackend.cs" />
+ <Compile Include="IQuotaInfo.cs" />
<Compile Include="IStreamingBackend.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="IGenericCallbackModule.cs" />
+ <Compile Include="QuotaInfo.cs" />
<Compile Include="ResultInterfaces.cs" />
<Compile Include="IWebModule.cs" />
<Compile Include="IConnectionModule.cs" />
diff --git a/Duplicati/Library/Interface/IQuotaEnabledBackend.cs b/Duplicati/Library/Interface/IQuotaEnabledBackend.cs index 57964f5d6..a813c1f85 100644 --- a/Duplicati/Library/Interface/IQuotaEnabledBackend.cs +++ b/Duplicati/Library/Interface/IQuotaEnabledBackend.cs @@ -11,16 +11,10 @@ namespace Duplicati.Library.Interface public interface IQuotaEnabledBackend : IBackend { /// <summary> - /// The total number of bytes available on the backend, - /// may return -1 if the particular host implementation - /// does not support quotas, but the backend does + /// Gets information about the quota on this backend. + /// This may return null if the particular host implementation + /// does not support quotas, but the backend does. /// </summary> - long TotalQuotaSpace { get; } - /// <summary> - /// The total number of unused bytes on the backend, - /// may return -1 if the particular host implementation - /// does not support quotas, but the backend does - /// </summary> - long FreeQuotaSpace { get; } + IQuotaInfo Quota { get; } } } diff --git a/Duplicati/Library/Interface/IQuotaInfo.cs b/Duplicati/Library/Interface/IQuotaInfo.cs new file mode 100644 index 000000000..81eb48153 --- /dev/null +++ b/Duplicati/Library/Interface/IQuotaInfo.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Duplicati.Library.Interface +{ + public interface IQuotaInfo + { + /// <summary> + /// The total number of bytes available on the backend, + /// This may return -1 if the particular host implementation + /// does not support quotas, but the backend does + /// </summary> + long TotalQuotaSpace { get; } + /// <summary> + /// The total number of unused bytes on the backend, + /// This may return -1 if the particular host implementation + /// does not support quotas, but the backend does + /// </summary> + long FreeQuotaSpace { get; } + } +} diff --git a/Duplicati/Library/Interface/QuotaInfo.cs b/Duplicati/Library/Interface/QuotaInfo.cs new file mode 100644 index 000000000..6158e1c7c --- /dev/null +++ b/Duplicati/Library/Interface/QuotaInfo.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Duplicati.Library.Interface +{ + public class QuotaInfo : IQuotaInfo + { + public QuotaInfo(long totalSpace, long freeSpace) + { + this.TotalQuotaSpace = totalSpace; + this.FreeQuotaSpace = freeSpace; + } + + public long TotalQuotaSpace { get; private set; } + + public long FreeQuotaSpace { get; private set; } + } +} |