// 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; using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; #nullable enable namespace Duplicati.Library.Interface; /// /// Interface for an instance of a file or folder /// public interface ISourceProviderEntry { /// /// True if the entry represents a folder, false otherwise /// bool IsFolder { get; } /// /// True if the entry is a meta entry, false otherwise /// bool IsMetaEntry { get; } /// /// True if the entry is the root entry, false otherwise /// bool IsRootEntry { get; } /// /// The creation time of the file or folder /// DateTime CreatedUtc { get; } /// /// The time the file or folder was last modified /// DateTime LastModificationUtc { get; } /// /// The name of the file or folder /// string Path { get; } /// /// The size of the file or folder /// long Size { get; } /// /// True if the file is a symlink, false otherwise /// bool IsSymlink { get; } /// /// The target of a symlink, if the file is a symlink /// string? SymlinkTarget { get; } /// /// The entry attributes /// FileAttributes Attributes { get; } /// /// The minor metadata of the file, should be less than 1KB /// Dictionary MinorMetadata { get; } /// /// True if the file is a block device, false otherwise /// bool IsBlockDevice { get; } /// /// True if the file is a character device, false otherwise /// bool IsCharacterDevice { get; } /// /// True if the files is an alternate stream, false otherwise /// bool IsAlternateStream { get; } /// /// The hardlink target id, if the file is a hardlink /// string? HardlinkTargetId { get; } /// /// Opens the file for reading /// /// A token that can be used to cancel the operation /// A stream that can be read Task OpenRead(CancellationToken cancellationToken); /// /// Opens the metadata for reading /// /// A token that can be used to cancel the operation /// A stream that can be read Task OpenMetadataRead(CancellationToken cancellationToken); /// /// Checks if the specified file exists /// /// The file to check for existence /// A token that can be used to cancel the operation /// true if the file exists, false otherwise Task FileExists(string filename, CancellationToken cancellationToken); /// /// Returns the contents of the object, if it is a folder /// /// A token that can be used to cancel the operation /// The contents of the folder IAsyncEnumerable Enumerate(CancellationToken cancellationToken); }