Class AzureCosmosDBFileService
- Namespace
- FoundationaLLM.Context.Services.CosmosDB
- Assembly
- FoundationaLLM.ContextEngine.dll
Provides the implementation for the Azure Cosmos DB file service.
public class AzureCosmosDBFileService : IAzureCosmosDBFileService
- Inheritance
-
AzureCosmosDBFileService
- Implements
- Inherited Members
- Extension Methods
Constructors
AzureCosmosDBFileService(IAzureCosmosDBServiceBase, ILogger<AzureCosmosDBFileService>)
Provides the implementation for the Azure Cosmos DB file service.
public AzureCosmosDBFileService(IAzureCosmosDBServiceBase azureCosmosDBServiceBase, ILogger<AzureCosmosDBFileService> logger)
Parameters
azureCosmosDBServiceBaseIAzureCosmosDBServiceBaseThe Azure Cosmos DB service that provides core database services.
loggerILogger<AzureCosmosDBFileService>The ILogger used for logging.
Methods
DeleteFileRecord(string, string, string)
Deletes the file record for a specified file identifier.
public Task DeleteFileRecord(string instanceId, string fileId, string userPrincipalName)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
fileIdstringThe idenfier of the file.
userPrincipalNamestringThe user principal name of the user associated with the file record.
Returns
Remarks
Bypassing owner check cannot be performed here as we need the partition key (which is the UPN) to perform the delete operation.
FileRecordExists(string, string, string)
Determines whether a file record exists for the specified file and user.
public Task<bool> FileRecordExists(string instanceId, string fileId, string userPrincipalName)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
fileIdstringThe unique identifier of the file to check for existence. Cannot be null or empty.
userPrincipalNamestringThe user principal name associated with the file record. Cannot be null or empty.
Returns
- Task<bool>
A task that represents the asynchronous operation. The task result is true if the file record exists for the specified user and instance; otherwise, false.
GetFileRecord(string, string, string, bool)
Gets the file record for a specified file identifier.
public Task<ContextFileRecord> GetFileRecord(string instanceId, string fileId, string userPrincipalName, bool bypassOwnerCheck)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
fileIdstringThe idenfier of the file.
userPrincipalNamestringThe user principal name of the user associated with the file record.
bypassOwnerCheckboolIndicates whether to bypass the owner check for the file record.
Returns
GetFileRecords(string, string, string, string, bool)
Gets the file records matching the specified criteria.
public Task<List<ContextFileRecord>> GetFileRecords(string instanceId, string conversationId, string fileName, string userPrincipalName, bool bypassOwnerCheck)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
conversationIdstringThe idenfier of the conversation to which the file is associated.
fileNamestringThe name of the file.
userPrincipalNamestringThe user principal name of the user associated with the file record.
bypassOwnerCheckboolIndicates whether to bypass the owner check for the file records.
Returns
UpsertFileRecord(ContextFileRecord)
Upserts a file record in the Azure Cosmos DB.
public Task UpsertFileRecord(ContextFileRecord fileRecord)
Parameters
fileRecordContextFileRecordThe file record to be upserted.