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
CopyFileAsync(string, string, string, CancellationToken)
Copies a file from one location to another within the specified storage container.
Task CopyFileAsync(string containerName, string sourceFilePath, string destinationFilePath, CancellationToken cancellationToken = default)
  Parameters
containerNamestringThe name of the container.
sourceFilePathstringThe path of the file to copy.
destinationFilePathstringThe path of the destination.
cancellationTokenCancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
DeleteFileAsync(string, string, CancellationToken)
Deletes a file from storage.
Task DeleteFileAsync(string containerName, string filePath, CancellationToken cancellationToken = default)
  Parameters
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to delete.
cancellationTokenCancellationTokenThe 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
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to read.
cancellationTokenCancellationTokenThe 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
containerNamestringName of the container, file system or Workspace name.
directoryPathstringDirectory to list file contents
recursiveboolRecurse through child folders
cancellationTokenCancellationTokenDetermines if a request should be cancelled.
Returns
GetMatchingFilePathsAsync(string, string, CancellationToken)
Retrieves a list of file paths that match a specific pattern.
Task<List<string>> GetMatchingFilePathsAsync(string containerName, string filePathPattern, CancellationToken cancellationToken = default)
  Parameters
containerNamestringThe name of the container.
filePathPatternstringThe file name pattern to match.
cancellationTokenCancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
ReadFile(string, string)
Reads the binary content of a specified file from the storage.
BinaryData ReadFile(string containerName, string filePath)
  Parameters
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to read.
Returns
- BinaryData
 The binary content of the file.
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
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to read.
cancellationTokenCancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
- Task<BinaryData>
 The binary content of the file.
UpdateJSONFileAsync<T>(string, string, Func<T, T>, CancellationToken)
Updates a specified JSON file in the storage.
Task UpdateJSONFileAsync<T>(string containerName, string filePath, Func<T, T> objectTransformer, CancellationToken cancellationToken) where T : class
  Parameters
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to update.
objectTransformerFunc<T, T>A function that updates the object persisted in the JSON file.
cancellationTokenCancellationTokenThe cancellation token that signals that operations should be cancelled.
Returns
Type Parameters
TThe type of the object persisted in the JSON 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
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to read.
fileContentStreamThe binary content written to the file.
contentTypestringAn optional content type.
cancellationTokenCancellationTokenThe 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
containerNamestringThe name of the container where the file is located.
filePathstringThe path of the file to read.
fileContentstringThe string content written to the file.
contentTypestringAn optional content type.
cancellationTokenCancellationTokenThe cancellation token that signals that operations should be cancelled.