using System; using System.Collections.Generic; namespace Svrnty.CQRS.Events.Abstractions.Configuration; /// /// Configuration for stream performance tuning. /// public class PerformanceConfiguration { /// /// Gets or sets the batch size for bulk operations. /// public int? BatchSize { get; set; } /// /// Gets or sets whether to enable compression for stored events. /// public bool? EnableCompression { get; set; } /// /// Gets or sets the compression algorithm to use (e.g., "gzip", "zstd"). /// public string? CompressionAlgorithm { get; set; } /// /// Gets or sets whether to enable indexing on metadata fields. /// public bool? EnableIndexing { get; set; } /// /// Gets or sets the list of metadata fields to index. /// public List? IndexedFields { get; set; } /// /// Gets or sets the cache size for frequently accessed events. /// public int? CacheSize { get; set; } /// /// Validates the performance configuration. /// /// Thrown when configuration is invalid. public void Validate() { if (BatchSize.HasValue && BatchSize.Value <= 0) throw new ArgumentException("BatchSize must be positive", nameof(BatchSize)); if (EnableCompression == true && string.IsNullOrWhiteSpace(CompressionAlgorithm)) throw new ArgumentException("CompressionAlgorithm must be specified when EnableCompression is true", nameof(CompressionAlgorithm)); if (EnableIndexing == true && (IndexedFields == null || IndexedFields.Count == 0)) throw new ArgumentException("IndexedFields must be specified when EnableIndexing is true", nameof(IndexedFields)); if (CacheSize.HasValue && CacheSize.Value < 0) throw new ArgumentException("CacheSize cannot be negative", nameof(CacheSize)); } }