Introduced a common module interface to avoid repeated code
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
namespace Duplicati.Library.Interface;
|
||||
|
||||
public interface ICommonModule : IDynamicModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the module key
|
||||
/// </summary>
|
||||
string Key { get; }
|
||||
/// <summary>
|
||||
/// Gets the display name of the module
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
/// <summary>
|
||||
/// Gets the description of the module
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
}
|
||||
@@ -28,9 +28,8 @@ using System.Threading.Tasks;
|
||||
namespace Duplicati.Library.Interface;
|
||||
|
||||
/// <summary>
|
||||
/// An interface a backend may implement if it supports streaming operations.
|
||||
/// Backends that implement this interface can be throttled and correctly shows
|
||||
/// the progressbar when transferring data.
|
||||
/// An interface for backends that support folder operations.
|
||||
/// Backends that implement this interface can be used as sources for data.
|
||||
/// </summary>
|
||||
public interface IFolderEnabledBackend : IBackend
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Collections.Generic;
|
||||
@@ -34,23 +34,8 @@ namespace Duplicati.Library.Interface
|
||||
/// All instances where the Configure method is called will be disposed,
|
||||
/// if they implement the IDisposable interface as well.
|
||||
/// </summary>
|
||||
public interface IGenericModule : IDynamicModule
|
||||
public interface IGenericModule : ICommonModule
|
||||
{
|
||||
/// <summary>
|
||||
/// The module key, used to activate or deactivate the module on the commandline
|
||||
/// </summary>
|
||||
string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A localized string describing the module with a friendly name
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A localized description of the module
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A boolean value that indicates if the module should always be loaded.
|
||||
/// If true, the user can choose to not load the module by entering the appropriate commandline option.
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Duplicati.Library.Interface;
|
||||
/// <summary>
|
||||
/// Interface for secret providers
|
||||
/// </summary>
|
||||
public interface ISecretProvider : IDynamicModule
|
||||
public interface ISecretProvider : ICommonModule
|
||||
{
|
||||
// abstract static Task<T> CreateAsync<T>(string config, CancellationToken cancellationToken)
|
||||
// where T : ISecretProvider;
|
||||
@@ -57,10 +57,6 @@ public interface ISecretProvider : IDynamicModule
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
Task SetSecretAsync(string key, string value, bool overwrite, CancellationToken cancellationToken);
|
||||
/// <summary>
|
||||
/// The key for the secret provider
|
||||
/// </summary>
|
||||
string Key { get; }
|
||||
/// <summary>
|
||||
/// Indicates whether the secret provider is supported on the current platform.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
@@ -69,12 +65,4 @@ public interface ISecretProvider : IDynamicModule
|
||||
/// Indicates whether the secret provider supports setting secrets.
|
||||
/// </summary>
|
||||
bool IsSetSupported { get; }
|
||||
/// <summary>
|
||||
/// The display name of the secret provider
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
/// <summary>
|
||||
/// The description of the secret provider
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public interface ISnapshotService : IDisposable
|
||||
/// <returns>The metadata for the given file or folder</returns>
|
||||
/// <param name="localPath">The file or folder to examine</param>
|
||||
/// <param name="isSymlink">A flag indicating if the target is a symlink</param>
|
||||
Dictionary<string, string> GetMetadata(string localPath, bool isSymlink);
|
||||
Dictionary<string, string?> GetMetadata(string localPath, bool isSymlink);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating if the path points to a block device
|
||||
|
||||
@@ -26,14 +26,6 @@ namespace Duplicati.Library.Interface;
|
||||
/// <summary>
|
||||
/// Implements a data source that can be backed up
|
||||
/// </summary>
|
||||
public interface ISourceProviderModule : ISourceProvider, IDynamicModule
|
||||
public interface ISourceProviderModule : ISourceProvider, ICommonModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the module key
|
||||
/// </summary>
|
||||
string Key { get; }
|
||||
/// <summary>
|
||||
/// Gets the display name of the module
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user