Class StateCosmosDBService
- Namespace
 - FoundationaLLM.State.Services
 
- Assembly
 - FoundationaLLM.State.dll
 
Service to access Azure Cosmos DB for NoSQL.
public class StateCosmosDBService : IStateCosmosDBService
  - Inheritance
 - 
      
      StateCosmosDBService
 
- Implements
 
- Inherited Members
 
- Extension Methods
 
Constructors
StateCosmosDBService(IOptions<AzureCosmosDBSettings>, CosmosClient, ILogger<StateCosmosDBService>)
Initializes a new instance of the StateCosmosDBService class.
public StateCosmosDBService(IOptions<AzureCosmosDBSettings> settings, CosmosClient client, ILogger<StateCosmosDBService> logger)
  Parameters
settingsIOptions<AzureCosmosDBSettings>The AzureCosmosDBSettings settings retrieved by the injected IOptions<TOptions>.
clientCosmosClientThe Cosmos DB client.
loggerILogger<StateCosmosDBService>The logging interface used to log under the StateCosmosDBService type name.
Exceptions
- ArgumentException
 Thrown if any of the required settings are null or empty.
Methods
GetLongRunningOperation(string, CancellationToken)
Retrieves a long-running operation by its identifier.
public Task<LongRunningOperation> GetLongRunningOperation(string id, CancellationToken cancellationToken = default)
  Parameters
idstringThe long-running operation identifier.
cancellationTokenCancellationToken
Returns
GetLongRunningOperationLogEntries(string, CancellationToken)
Retrieves all log entries for a long-running operation.
public Task<List<LongRunningOperationLogEntry>> GetLongRunningOperationLogEntries(string operationId, CancellationToken cancellationToken = default)
  Parameters
operationIdstringThe long-running operation identifier.
cancellationTokenCancellationToken
Returns
GetLongRunningOperationResult(string, CancellationToken)
Retrieves the result of a long-running operation.
public Task<JsonDocument?> GetLongRunningOperationResult(string operationId, CancellationToken cancellationToken = default)
  Parameters
operationIdstringThe long-running operation identifier.
cancellationTokenCancellationToken
Returns
GetLongRunningOperations(CancellationToken)
Retrieves all long-running operations.
public Task<List<LongRunningOperation>> GetLongRunningOperations(CancellationToken cancellationToken = default)
  Parameters
cancellationTokenCancellationToken
Returns
UpsertLongRunningOperation(LongRunningOperation, CancellationToken)
Inserts or updates a long-running operation and creates a log entry.
public Task<LongRunningOperation> UpsertLongRunningOperation(LongRunningOperation operation, CancellationToken cancellationToken = default)
  Parameters
operationLongRunningOperationThe long-running operation to insert or update.
cancellationTokenCancellationToken
Returns
UpsertLongRunningOperationResult(dynamic, CancellationToken)
Inserts or updates the result of a long-running operation.
public Task<object?> UpsertLongRunningOperationResult(dynamic operationResult, CancellationToken cancellationToken = default)
  Parameters
operationResultdynamicThe operation result to insert or update.
cancellationTokenCancellationToken