61 lines
2.3 KiB
C#
61 lines
2.3 KiB
C#
using System;
|
|
using Svrnty.CQRS.Events.Abstractions.Streaming;
|
|
using Svrnty.CQRS.Events.Abstractions.Configuration;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Svrnty.CQRS.Events.Abstractions.Streaming;
|
|
|
|
/// <summary>
|
|
/// Store for managing stream-specific configuration.
|
|
/// </summary>
|
|
public interface IStreamConfigurationStore
|
|
{
|
|
/// <summary>
|
|
/// Gets configuration for a specific stream.
|
|
/// </summary>
|
|
/// <param name="streamName">The name of the stream.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>The stream configuration if found; otherwise null.</returns>
|
|
Task<StreamConfiguration?> GetConfigurationAsync(
|
|
string streamName,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Gets all stream configurations.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>List of all stream configurations.</returns>
|
|
Task<IReadOnlyList<StreamConfiguration>> GetAllConfigurationsAsync(
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Sets or updates configuration for a stream.
|
|
/// </summary>
|
|
/// <param name="configuration">The stream configuration to set.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
Task SetConfigurationAsync(
|
|
StreamConfiguration configuration,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Deletes configuration for a stream (reverts to defaults).
|
|
/// </summary>
|
|
/// <param name="streamName">The name of the stream.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
Task DeleteConfigurationAsync(
|
|
string streamName,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Gets configurations matching a filter.
|
|
/// </summary>
|
|
/// <param name="predicate">The filter predicate.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>List of matching stream configurations.</returns>
|
|
Task<IReadOnlyList<StreamConfiguration>> FindConfigurationsAsync(
|
|
Func<StreamConfiguration, bool> predicate,
|
|
CancellationToken cancellationToken = default);
|
|
}
|