using System; using Svrnty.CQRS.Events.Abstractions.Replay; namespace Svrnty.CQRS.Events.Abstractions.Replay; /// /// Progress information for replay operations. /// public record ReplayProgress { /// /// Current offset being processed. /// public required long CurrentOffset { get; init; } /// /// Total number of events processed so far. /// public required long EventsProcessed { get; init; } /// /// Estimated total events to replay (if known). /// public long? EstimatedTotal { get; init; } /// /// Current timestamp of event being processed. /// public DateTimeOffset? CurrentTimestamp { get; init; } /// /// Elapsed time since replay started. /// public required TimeSpan Elapsed { get; init; } /// /// Events per second processing rate. /// public double EventsPerSecond => EventsProcessed / Math.Max(Elapsed.TotalSeconds, 0.001); /// /// Progress percentage (0-100) if total is known. /// public double? ProgressPercentage => EstimatedTotal.HasValue && EstimatedTotal.Value > 0 ? (EventsProcessed / (double)EstimatedTotal.Value) * 100 : null; }