Interface IStorageService
- Namespace
- FoundationaLLM.Common.Interfaces
- Assembly
- FoundationaLLM.Common.dll
Provides services to interact with a storage.
public interface IStorageService
- Extension Methods
Properties
InstanceName
The optional instance name of the storage service.
string? InstanceName { get; set; }
Property Value
StorageAccountName
The name of the storage account.
string? StorageAccountName { get; }
Property Value
StorageContainerName
The name of the storage container.
string? StorageContainerName { get; }
Property Value
Methods
DeleteFileAsync(string, string, CancellationToken)
Deletes a file from storage.
Task DeleteFileAsync(string containerName, string filePath, CancellationToken cancellationToken = default)
Parameters
containerName
stringThe name of the container where the file is located.
filePath
stringThe path of the file to delete.
cancellationToken
CancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
FileExistsAsync(string, string, CancellationToken)
Checks if a file exists on the storage.
Task<bool> FileExistsAsync(string containerName, string filePath, CancellationToken cancellationToken)
Parameters
containerName
stringThe name of the container where the file is located.
filePath
stringThe path of the file to read.
cancellationToken
CancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
GetFilePathsAsync(string, string?, bool, CancellationToken)
Retrieves a list file paths in the specific directory.
Task<List<string>> GetFilePathsAsync(string containerName, string? directoryPath = null, bool recursive = true, CancellationToken cancellationToken = default)
Parameters
containerName
stringName of the container, file system or Workspace name.
directoryPath
stringDirectory to list file contents
recursive
boolRecurse through child folders
cancellationToken
CancellationTokenDetermines if a request should be cancelled.
Returns
ReadFileAsync(string, string, CancellationToken)
Reads the binary content of a specified file from the storage.
Task<BinaryData> ReadFileAsync(string containerName, string filePath, CancellationToken cancellationToken)
Parameters
containerName
stringThe name of the container where the file is located.
filePath
stringThe path of the file to read.
cancellationToken
CancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
- Task<BinaryData>
The binary content of the file.
WriteFileAsync(string, string, Stream, string?, CancellationToken)
Writes the binary content to a specified file from the storage.
Task WriteFileAsync(string containerName, string filePath, Stream fileContent, string? contentType, CancellationToken cancellationToken)
Parameters
containerName
stringThe name of the container where the file is located.
filePath
stringThe path of the file to read.
fileContent
StreamThe binary content written to the file.
contentType
stringAn optional content type.
cancellationToken
CancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
WriteFileAsync(string, string, string, string?, CancellationToken)
Writes the string content to a specified file from the storage.
Task WriteFileAsync(string containerName, string filePath, string fileContent, string? contentType, CancellationToken cancellationToken)
Parameters
containerName
stringThe name of the container where the file is located.
filePath
stringThe path of the file to read.
fileContent
stringThe string content written to the file.
contentType
stringAn optional content type.
cancellationToken
CancellationTokenThe cancellation token that signals that operations should be cancelled.