// // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see https://www.gnu.org/licenses/. // namespace slskd.Shares { using System.Collections.Generic; using Soulseek; /// /// Persistent storage of shared files and metadata. /// public interface IShareRepository { /// /// Gets the connection string for this repository. /// string ConnectionString { get; } /// /// Counts the number of directories in the database. /// /// The optional directory prefix used for counting subdirectories. /// The number of directories. int CountDirectories(string parentDirectory = null); /// /// Counts the number of files in the database. /// /// The optional directory prefix used for counting files in a subdirectory. /// The number of files. int CountFiles(string parentDirectory = null); /// /// Finds the filename of the file matching the specified . /// /// The fully qualified remote path of the file. /// The filename, if found. string FindFilename(string maskedFilename); /// /// Lists all directories. /// /// The optional directory prefix used for listing subdirectories. /// The list of directories. IEnumerable ListDirectories(string parentDirectory = null); /// /// Lists all files. /// /// The optional parent directory. /// A value indicating whether the fully qualified path should be returned. /// The list of files. IEnumerable ListFiles(string parentDirectory = null, bool includeFullPath = false); /// /// Searches the database for files matching the specified . /// /// The search query. /// The list of matching files. IEnumerable Search(SearchQuery query); /// /// Attempts to validate the database at the specified , or the /// default . /// /// The connection string of the database to validate. /// A value indicating whether the database is valid. bool TryValidate(string connectionString = null); } }