private record ProtoBlock()

in code/KustoCopyConsole/Runner/PlanningRunner.cs [16:44]


        private record ProtoBlock(
            DateTime IngestionTimeStart,
            DateTime IngestionTimeEnd,
            long RowCount,
            DateTime MinCreationTime,
            DateTime MaxCreationTime)
        {
            public ProtoBlock Merge(ProtoBlock other)
            {
                return new ProtoBlock(
                    Min(IngestionTimeStart, other.IngestionTimeStart),
                    Max(IngestionTimeEnd, other.IngestionTimeEnd),
                    RowCount + other.RowCount,
                    Min(MinCreationTime, MaxCreationTime),
                    Max(MinCreationTime, MaxCreationTime));
            }

            public TimeSpan? CreationTimeDelta => MaxCreationTime - MinCreationTime;

            private static DateTime Min(DateTime a, DateTime b)
            {
                return a < b ? a : b;
            }

            private static DateTime Max(DateTime a, DateTime b)
            {
                return a > b ? a : b;
            }
        }