Class StateService
- Namespace
- FoundationaLLM.State.Services
- Assembly
- FoundationaLLM.State.dll
Provides methods for managing state for long-running operations.
public class StateService : IStateService
- Inheritance
-
StateService
- Implements
- Inherited Members
- Extension Methods
Constructors
StateService(IOptions<StateServiceSettings>, ICosmosDbService, ILogger<StateService>)
Provides methods for managing state for long-running operations.
public StateService(IOptions<StateServiceSettings> options, ICosmosDbService cosmosDbService, ILogger<StateService> logger)
Parameters
options
IOptions<StateServiceSettings>Provides the options with the StateServiceSettings settings for configuration.
cosmosDbService
ICosmosDbServiceProvides methods to interact with Cosmos DB.
logger
ILogger<StateService>The ILogger used for logging.
Methods
CreateLongRunningOperation(string, string)
Creates a new long-running operation with default values.
public Task<LongRunningOperation> CreateLongRunningOperation(string operationId, string upn)
Parameters
operationId
stringThe long-running operation identifier.
upn
stringThe User Principal Name (UPN) of the user who triggered the long-running operation.
Returns
GetLongRunningOperation(string)
Retrieves a long-running operation by its identifier.
public Task<LongRunningOperation> GetLongRunningOperation(string id)
Parameters
id
stringThe long-running operation identifier.
Returns
GetLongRunningOperationLogEntries(string)
Retrieves all log entries for a long-running operation.
public Task<List<LongRunningOperationLogEntry>> GetLongRunningOperationLogEntries(string operationId)
Parameters
operationId
stringThe long-running operation identifier.
Returns
GetLongRunningOperationResult(string)
Retrieves the result of a long-running operation.
public Task<JsonDocument?> GetLongRunningOperationResult(string operationId)
Parameters
operationId
stringThe long-running operation identifier.
Returns
GetLongRunningOperations()
Retrieves all long-running operations.
public Task<List<LongRunningOperation>> GetLongRunningOperations()
Returns
UpsertLongRunningOperation(LongRunningOperation)
Inserts or updates a long-running operation and creates a log entry.
public Task<LongRunningOperation> UpsertLongRunningOperation(LongRunningOperation operation)
Parameters
operation
LongRunningOperationThe long-running operation to insert or update.
Returns
UpsertLongRunningOperationResult(dynamic)
Inserts or updates the result of a long-running operation.
public Task<object?> UpsertLongRunningOperationResult(dynamic operationResult)
Parameters
operationResult
dynamicThe operation result to insert or update.