dotnet-cqrs/Svrnty.CQRS.Events.PostgreSQL/Configuration/PostgresEventStreamStoreOptions.cs

100 lines
3.1 KiB
C#

using System;
using Svrnty.CQRS.Events.PostgreSQL.Configuration;
namespace Svrnty.CQRS.Events.PostgreSQL.Configuration;
/// <summary>
/// Configuration options for PostgreSQL event stream storage.
/// </summary>
public sealed class PostgresEventStreamStoreOptions
{
/// <summary>
/// PostgreSQL connection string.
/// </summary>
/// <remarks>
/// Example: "Host=localhost;Database=mydb;Username=myuser;Password=mypass"
/// </remarks>
public required string ConnectionString { get; set; }
/// <summary>
/// Schema name for event streaming tables.
/// </summary>
/// <remarks>
/// Defaults to "event_streaming". Allows isolation of event tables from application tables.
/// </remarks>
public string SchemaName { get; set; } = "event_streaming";
/// <summary>
/// Table name for persistent events.
/// </summary>
/// <remarks>
/// Defaults to "events". Used for append-only event log storage.
/// </remarks>
public string EventsTableName { get; set; } = "events";
/// <summary>
/// Table name for ephemeral queue events.
/// </summary>
/// <remarks>
/// Defaults to "queue_events". Used for message queue semantics.
/// </remarks>
public string QueueEventsTableName { get; set; } = "queue_events";
/// <summary>
/// Table name for consumer offsets.
/// </summary>
/// <remarks>
/// Defaults to "consumer_offsets". Tracks consumer position in persistent streams.
/// </remarks>
public string OffsetsTableName { get; set; } = "consumer_offsets";
/// <summary>
/// Maximum number of connections in the connection pool.
/// </summary>
/// <remarks>
/// Defaults to 100. Adjust based on your application's concurrency needs.
/// </remarks>
public int MaxPoolSize { get; set; } = 100;
/// <summary>
/// Minimum number of connections in the connection pool.
/// </summary>
/// <remarks>
/// Defaults to 0. Connections are created on demand.
/// </remarks>
public int MinPoolSize { get; set; } = 0;
/// <summary>
/// Command timeout in seconds.
/// </summary>
/// <remarks>
/// Defaults to 30 seconds. Increase for operations on very large streams.
/// </remarks>
public int CommandTimeout { get; set; } = 30;
/// <summary>
/// Enable automatic schema creation and migration.
/// </summary>
/// <remarks>
/// Defaults to true for development. Set to false in production and use migration scripts.
/// </remarks>
public bool AutoMigrate { get; set; } = true;
/// <summary>
/// Enable table partitioning for the events table.
/// </summary>
/// <remarks>
/// Defaults to false. When enabled, creates monthly partitions for better performance on large datasets.
/// Requires PostgreSQL 10+.
/// </remarks>
public bool EnablePartitioning { get; set; } = false;
/// <summary>
/// Batch size for reading events from persistent streams.
/// </summary>
/// <remarks>
/// Defaults to 1000. Maximum number of events returned per ReadStreamAsync call.
/// </remarks>
public int ReadBatchSize { get; set; } = 1000;
}