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.
///
[Obsolete("Use GetFileStreamAsync() instead. This method will be removed in a future version.")]
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.
///
[Obsolete("Use GetFileContentAsync() instead. This method will be removed in a future version.")]
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.
///
[Obsolete("Use GetFileLengthAsync() instead. This method will be removed in a future version.")]
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 flag indicating whether to continue if a file isn't found or to stop and throw a FileNotFoundException.
/// A collection of file types which can store the files.
[Obsolete("Use GetFilesAsync() instead. This method will be removed in a future version.")]
void GetFiles(IEnumerable udis, bool continueOnFileNotFound, IFileTypeCollection fileTypes);
///
/// 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.
///
/// The task object representing the asynchronous operation.
///
Task GetFilesAsync(IEnumerable udis, IFileTypeCollection fileTypes, bool continueOnFileNotFound, CancellationToken token);
}