namespace Umbraco.Cms.Core.Deploy; /// /// Represents a file source, ie a mean for a target environment involved in a /// deployment to obtain the content of files being deployed. /// public interface IFileSource { /// /// Gets the content of a file as a stream. /// /// A file entity identifier. /// A stream with read access to the file content. /// /// Returns null if no content could be read. /// The caller should ensure that the stream is properly closed/disposed. /// Stream GetFileStream(StringUdi udi); /// /// Gets the content of a file as a stream. /// /// A file entity identifier. /// A cancellation token. /// A stream with read access to the file content. /// /// Returns null if no content could be read. /// The caller should ensure that the stream is properly closed/disposed. /// Task GetFileStreamAsync(StringUdi udi, CancellationToken token); /// /// Gets the content of a file as a string. /// /// A file entity identifier. /// A string containing the file content. /// Returns null if no content could be read. string GetFileContent(StringUdi udi); /// /// Gets the content of a file as a string. /// /// A file entity identifier. /// A cancellation token. /// A string containing the file content. /// Returns null if no content could be read. Task GetFileContentAsync(StringUdi udi, CancellationToken token); /// /// Gets the length of a file. /// /// A file entity identifier. /// The length of the file, or -1 if the file does not exist. long GetFileLength(StringUdi udi); /// /// Gets the length of a file. /// /// A file entity identifier. /// A cancellation token. /// The length of the file, or -1 if the file does not exist. Task GetFileLengthAsync(StringUdi udi, CancellationToken token); /// /// Gets files and store them using a file store. /// /// The udis of the files to get. /// A collection of file types which can store the files. void GetFiles(IEnumerable udis, IFileTypeCollection fileTypes); // TODO (V14): Remove obsolete method and default implementation for GetFilesAsync overloads. /// /// Gets files and store them using a file store. /// /// The udis of the files to get. /// A collection of file types which can store the files. /// A cancellation token. [Obsolete("Please use the method overload taking all parameters. This method overload will be removed in Umbraco 14.")] Task GetFilesAsync(IEnumerable udis, IFileTypeCollection fileTypes, CancellationToken token); /// /// Gets files and store them using a file store. /// /// The udis of the files to get. /// A collection of file types which can store the files. /// A flag indicating whether to continue if a file isn't found or to stop and throw a FileNotFoundException. /// A cancellation token. Task GetFilesAsync(IEnumerable udis, IFileTypeCollection fileTypes, bool continueOnFileNotFound, CancellationToken token) => GetFilesAsync(udis, fileTypes, token); }