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>, IStateCosmosDBService, ILogger<StateService>)
Provides methods for managing state for long-running operations.
public StateService(IOptions<StateServiceSettings> options, IStateCosmosDBService cosmosDbService, ILogger<StateService> logger)
  Parameters
optionsIOptions<StateServiceSettings>Provides the options with the StateServiceSettings settings for configuration.
cosmosDbServiceIStateCosmosDBServiceProvides methods to interact with Cosmos DB.
loggerILogger<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
operationIdstringThe long-running operation identifier.
upnstringThe 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
idstringThe long-running operation identifier.
Returns
GetLongRunningOperationLogEntries(string)
Retrieves all log entries for a long-running operation.
public Task<List<LongRunningOperationLogEntry>> GetLongRunningOperationLogEntries(string operationId)
  Parameters
operationIdstringThe long-running operation identifier.
Returns
GetLongRunningOperationResult(string)
Retrieves the result of a long-running operation.
public Task<JsonDocument?> GetLongRunningOperationResult(string operationId)
  Parameters
operationIdstringThe 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
operationLongRunningOperationThe 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
operationResultdynamicThe operation result to insert or update.