#region Disclaimer / License // Copyright (C) 2015, The Duplicati Team // http://www.duplicati.com, info@duplicati.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #endregion using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Duplicati.Library.Interface { /// /// The interface all backends must implement. /// The classes that implements this interface MUST also /// implement a default constructor and a constructor that /// has the signature new(string url, Dictionary<string, string> options). /// The default constructor is used to construct an instance /// so the DisplayName and other values can be read. /// The other constructor is used to do the actual work. /// An instance is never reused. /// public interface IBackend : IDisposable { /// /// The localized name to display for this backend /// string DisplayName { get;} /// /// The protocol key, eg. ftp, http or ssh /// string ProtocolKey { get; } /// /// Enumerates a list of files found on the remote location /// /// The list of files IEnumerable List(); /// /// Puts the content of the file to the url passed /// /// The remote filename, relative to the URL /// The local filename /// Token to cancel the operation. Task PutAsync(string remotename, string filename, CancellationToken cancelToken); /// /// Downloads a file with the remote data /// /// The remote filename, relative to the URL /// The local filename void Get(string remotename, string filename); /// /// Deletes the specified file /// /// The remote filename, relative to the URL void Delete(string remotename); /// /// Gets a list of supported commandline arguments /// IList SupportedCommands { get; } /// /// A localized description of the backend, for display in the usage information /// string Description { get; } /// /// The DNS names used to resolve the IP addresses for this backend /// string[] DNSName { get; } /// /// The purpose of this method is to test the connection to the remote backend. /// If any problem is encountered, this method should throw an exception. /// If the encountered problem is a missing target "folder", /// this method should throw a . /// void Test(); /// /// The purpose of this method is to create the underlying "folder". /// This method will be invoked if the method throws a /// . /// Backends that have no "folder" concept should not throw /// a during , /// and this method should throw a . /// void CreateFolder(); } }