stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// ArtifactMigrationState.cs
|
||||
// Sprint: SPRINT_20260118_017_Evidence_artifact_store_unification
|
||||
// Task: AS-006 - Migrate existing evidence to unified store
|
||||
// Description: Tracks migration progress state
|
||||
// -----------------------------------------------------------------------------
|
||||
namespace StellaOps.Artifact.Infrastructure;
|
||||
|
||||
internal sealed class ArtifactMigrationState
|
||||
{
|
||||
private readonly TimeProvider _timeProvider;
|
||||
|
||||
public ArtifactMigrationState(int totalItems, TimeProvider timeProvider)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(timeProvider);
|
||||
_timeProvider = timeProvider;
|
||||
TotalItems = totalItems;
|
||||
StartedAt = _timeProvider.GetUtcNow();
|
||||
LastUpdateAt = StartedAt;
|
||||
}
|
||||
|
||||
public int TotalItems { get; }
|
||||
public int ProcessedItems { get; private set; }
|
||||
public int SuccessCount { get; private set; }
|
||||
public int FailureCount { get; private set; }
|
||||
public int SkippedCount { get; private set; }
|
||||
public DateTimeOffset StartedAt { get; }
|
||||
public DateTimeOffset LastUpdateAt { get; private set; }
|
||||
|
||||
public MigrationProgress Apply(ArtifactMigrationResult result)
|
||||
{
|
||||
ProcessedItems++;
|
||||
if (result.Success && !result.Skipped)
|
||||
{
|
||||
SuccessCount++;
|
||||
}
|
||||
else if (result.Skipped)
|
||||
{
|
||||
SkippedCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FailureCount++;
|
||||
}
|
||||
|
||||
LastUpdateAt = _timeProvider.GetUtcNow();
|
||||
|
||||
return new MigrationProgress
|
||||
{
|
||||
TotalItems = TotalItems,
|
||||
ProcessedItems = ProcessedItems,
|
||||
SuccessCount = SuccessCount,
|
||||
FailureCount = FailureCount,
|
||||
SkippedCount = SkippedCount,
|
||||
StartedAt = StartedAt,
|
||||
LastUpdateAt = LastUpdateAt,
|
||||
CurrentItem = result.OriginalPath
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user