diff --git a/idou.Core/Engine/IJobStateStore.cs b/idou.Core/Engine/IJobStateStore.cs new file mode 100644 index 0000000..2769695 --- /dev/null +++ b/idou.Core/Engine/IJobStateStore.cs @@ -0,0 +1,13 @@ +using idou.Core.Domain.Enums; + +namespace idou.Core.Engine; + +public interface IJobStateStore +{ + JobStatus GetStatus(string jobId); + JobProgress GetProgress(string jobId); + void SetStatus(string jobId, JobStatus status); + void UpdateProgress(string jobId, JobProgress progress); + void AppendLog(string jobId, string message); + IReadOnlyList ReadLogs(string jobId, int tail); +} \ No newline at end of file diff --git a/idou.Core/Engine/JobProgress.cs b/idou.Core/Engine/JobProgress.cs new file mode 100644 index 0000000..4cbf51e --- /dev/null +++ b/idou.Core/Engine/JobProgress.cs @@ -0,0 +1,13 @@ +using idou.Core.Domain; + +namespace idou.Core.Engine; + +public class JobProgress +{ + public long ProcessedChanges { get; } + public long AppliedChanges { get; } + public long FailedChanges { get; } + public DateTimeOffset? LastSuccessfulApplyAt { get; } + public Checkpoint? LastCheckpoint { get; } + public string? LastErrorMessage { get; } +} \ No newline at end of file