/* * * (c) Copyright Ascensio System Limited 2010-2018 * * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. * * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html * * You can contact Ascensio System SIA by email at sales@onlyoffice.com * * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. * * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains * relevant author attributions when distributing the software. If the display of the logo in its graphic * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" * in every copy of the program you distribute. * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. * */ using System; using System.Collections.Generic; using System.IO; using ASC.Data.Storage.Configuration; namespace ASC.Data.Storage { /// /// Interface for working with files /// public interface IDataStore { IQuotaController QuotaController { get; set; } TimeSpan GetExpire(string domain); /// /// Get absolute Uri for html links to handler /// /// /// Uri GetUri(string path); /// /// Get absolute Uri for html links to handler /// /// /// /// Uri GetUri(string domain, string path); /// /// Get absolute Uri for html links to handler /// /// /// /// /// /// Uri GetPreSignedUri(string domain, string path, TimeSpan expire, IEnumerable headers); /// /// Supporting generate uri to the file /// /// bool IsSupportInternalUri { get; } /// /// Get absolute Uri for html links /// /// /// /// /// /// Uri GetInternalUri(string domain, string path, TimeSpan expire, IEnumerable headers); /// /// A stream of read-only. In the case of the C3 stream NetworkStream general, and with him we have to work /// Very carefully as a Jedi cutter groin lightsaber. /// /// /// /// Stream GetReadStream(string domain, string path); /// /// A stream of read-only. In the case of the C3 stream NetworkStream general, and with him we have to work /// Very carefully as a Jedi cutter groin lightsaber. /// /// /// /// Stream GetReadStream(string domain, string path, int offset); /// /// Saves the contents of the stream in the repository. /// /// /// /// flow. Is read from the current position! Desirable to set to 0 when the transmission MemoryStream instance /// Uri Save(string domain, string path, Stream stream); /// /// Saves the contents of the stream in the repository. /// /// /// /// /// /// Uri Save(string domain, string path, Stream stream, ACL acl); /// /// Saves the contents of the stream in the repository. /// /// /// /// /// /// Uri Save(string domain, string path, Stream stream, string attachmentFileName); /// /// Saves the contents of the stream in the repository. /// /// /// /// /// /// /// Uri Save(string domain, string path, Stream stream, string contentType, string contentDisposition); /// /// Saves the contents of the stream in the repository. /// /// /// /// /// /// /// Uri Save(string domain, string path, Stream stream, string contentEncoding, int cacheDays); string InitiateChunkedUpload(string domain, string path); string UploadChunk(string domain, string path, string uploadId, Stream stream, long defaultChunkSize, int chunkNumber, long chunkLength); Uri FinalizeChunkedUpload(string domain, string path, string uploadId, Dictionary eTags); void AbortChunkedUpload(string domain, string path, string uploadId); bool IsSupportChunking { get; } bool IsSupportedPreSignedUri { get; } /// /// Deletes file /// /// /// void Delete(string domain, string path); /// /// Deletes file by mask /// /// /// ///Wildcard mask (*.png) /// void DeleteFiles(string domain, string folderPath, string pattern, bool recursive); /// /// Deletes files /// /// /// void DeleteFiles(string domain, List paths); /// /// Deletes file by last modified date /// /// /// /// /// void DeleteFiles(string domain, string folderPath, DateTime fromDate, DateTime toDate); /// /// Moves the contents of one directory to another. s3 for a very expensive procedure. /// /// /// /// /// void MoveDirectory(string srcdomain, string srcdir, string newdomain, string newdir); /// /// Moves file /// /// /// /// /// /// Uri Move(string srcdomain, string srcpath, string newdomain, string newpath); /// /// Saves the file in the temp. In fact, almost no different from the usual Save except that generates the file name itself. An inconvenient thing. /// /// /// /// /// Uri SaveTemp(string domain, out string assignedPath, Stream stream); /// /// Returns a list of links to all subfolders /// /// /// /// iterate subdirectories or not /// string[] ListDirectoriesRelative(string domain, string path, bool recursive); /// /// Returns a list of links to all files /// /// /// ///Wildcard mask (*. jpg for example) ///iterate subdirectories or not /// Uri[] ListFiles(string domain, string path, string pattern, bool recursive); /// /// Returns a list of relative paths for all files /// /// /// ///Wildcard mask (*. jpg for example) ///iterate subdirectories or not /// string[] ListFilesRelative(string domain, string path, string pattern, bool recursive); /// /// Checks whether a file exists. On s3 it took long time. /// /// /// /// bool IsFile(string domain, string path); /// /// Checks whether a directory exists. On s3 it took long time. /// /// /// /// bool IsDirectory(string domain, string path); void DeleteDirectory(string domain, string path); long GetFileSize(string domain, string path); long GetDirectorySize(string domain, string path); long ResetQuota(string domain); long GetUsedQuota(string domain); Uri Copy(string srcdomain, string path, string newdomain, string newpath); void CopyDirectory(string srcdomain, string dir, string newdomain, string newdir); //Then there are restarted methods without domain. functionally identical to the top #pragma warning disable 1591 Stream GetReadStream(string path); Uri Save(string path, Stream stream, string attachmentFileName); Uri Save(string path, Stream stream); void Delete(string path); void DeleteFiles(string folderPath, string pattern, bool recursive); Uri Move(string srcpath, string newdomain, string newpath); Uri SaveTemp(out string assignedPath, Stream stream); string[] ListDirectoriesRelative(string path, bool recursive); Uri[] ListFiles(string path, string pattern, bool recursive); bool IsFile(string path); bool IsDirectory(string path); void DeleteDirectory(string path); long GetFileSize(string path); long GetDirectorySize(string path); Uri Copy(string path, string newdomain, string newpath); void CopyDirectory(string dir, string newdomain, string newdir); #pragma warning restore 1591 IDataStore Configure(string tenant, Handler handlerConfig, Module moduleConfig, IDictionary props); IDataStore SetQuotaController(IQuotaController controller); string SavePrivate(string domain, string path, Stream stream, DateTime expires); void DeleteExpired(string domain, string path, TimeSpan oldThreshold); string GetUploadForm(string domain, string directoryPath, string redirectTo, long maxUploadSize, string contentType, string contentDisposition, string submitLabel); string GetUploadedUrl(string domain, string directoryPath); string GetUploadUrl(); string GetPostParams(string domain, string directoryPath, long maxUploadSize, string contentType, string contentDisposition); } }