using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Svrnty.CQRS.Sagas.Abstractions.Persistence; /// /// Abstraction for saga state persistence. /// public interface ISagaStateStore { /// /// Creates a new saga state entry. /// /// The saga state to create. /// Cancellation token. /// The created saga state. Task CreateAsync(SagaState state, CancellationToken cancellationToken = default); /// /// Gets a saga state by its ID. /// /// The saga instance ID. /// Cancellation token. /// The saga state, or null if not found. Task GetByIdAsync(Guid sagaId, CancellationToken cancellationToken = default); /// /// Gets a saga state by its correlation ID. /// /// The correlation ID. /// Cancellation token. /// The saga state, or null if not found. Task GetByCorrelationIdAsync(Guid correlationId, CancellationToken cancellationToken = default); /// /// Updates an existing saga state. /// /// The saga state to update. /// Cancellation token. /// The updated saga state. Task UpdateAsync(SagaState state, CancellationToken cancellationToken = default); /// /// Gets all pending (in progress) sagas. /// /// Cancellation token. /// List of pending saga states. Task> GetPendingSagasAsync(CancellationToken cancellationToken = default); /// /// Gets all sagas with a specific status. /// /// The status to filter by. /// Cancellation token. /// List of saga states with the specified status. Task> GetSagasByStatusAsync(SagaStatus status, CancellationToken cancellationToken = default); }