Class DataLakeStorageService
- Namespace
- FoundationaLLM.Common.Services.Storage
- Assembly
- FoundationaLLM.Common.dll
Provides access to Azure Data Lake blob storage.
public class DataLakeStorageService : StorageServiceBase, IStorageService
- Inheritance
-
DataLakeStorageService
- Implements
- Inherited Members
- Extension Methods
Constructors
DataLakeStorageService(BlobStorageServiceSettings, ILogger<DataLakeStorageService>)
Initializes a new instance of the DataLakeStorageService with the specified options and logger.
public DataLakeStorageService(BlobStorageServiceSettings storageSettings, ILogger<DataLakeStorageService> logger)
Parameters
storageSettings
BlobStorageServiceSettingsThe BlobStorageServiceSettings object with the blob storage settings.
logger
ILogger<DataLakeStorageService>The logger used for logging.
DataLakeStorageService(IOptions<BlobStorageServiceSettings>, ILogger<DataLakeStorageService>)
Initializes a new instance of the DataLakeStorageService with the specified options and logger.
public DataLakeStorageService(IOptions<BlobStorageServiceSettings> options, ILogger<DataLakeStorageService> logger)
Parameters
options
IOptions<BlobStorageServiceSettings>The options object containing the BlobStorageServiceSettings object with the blob storage settings.
logger
ILogger<DataLakeStorageService>The logger used for logging.
Properties
StorageAccountName
The name of the storage account.
public string StorageAccountName { get; }
Property Value
Methods
CreateClientFromAccountKey(string, string)
Creates a storage client from an account name and an account key.
protected override void CreateClientFromAccountKey(string accountName, string accountKey)
Parameters
CreateClientFromConnectionString(string)
Creates a storage client from a connection string.
protected override void CreateClientFromConnectionString(string connectionString)
Parameters
connectionString
stringThe storage connection string.
CreateClientFromIdentity(string)
Create a storage client from an account name using the default identity for authentication.
protected override void CreateClientFromIdentity(string accountName)
Parameters
accountName
stringThe storage account name.
DeleteFileAsync(string, string, CancellationToken)
Deletes a file from storage.
public 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.
public Task<bool> FileExistsAsync(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 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.
public 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.
public Task<BinaryData> ReadFileAsync(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 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.
public 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.
public 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.