mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 14:13:12 +00:00
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
namespace SeaHaven.DataServices.Interfaces
|
|
{
|
|
public interface IWorkOrderReconciliationDataService
|
|
{
|
|
Task<ReconciliationJobSnapshot> EnqueueAsync(
|
|
string reason,
|
|
DateTimeOffset now,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task<ReconciliationLease?> TryAcquirePendingAsync(
|
|
DateTimeOffset now,
|
|
TimeSpan leaseDuration,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task<ReconciliationJobSnapshot> GetStatusAsync(CancellationToken cancellationToken);
|
|
|
|
Task<bool> RenewLeaseAsync(
|
|
Guid runId,
|
|
Guid fenceToken,
|
|
DateTimeOffset now,
|
|
TimeSpan leaseDuration,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task CompleteAsync(
|
|
Guid runId,
|
|
Guid fenceToken,
|
|
DateTimeOffset completedAt,
|
|
int workOrders,
|
|
int comments,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task FailAsync(
|
|
Guid runId,
|
|
Guid fenceToken,
|
|
DateTimeOffset completedAt,
|
|
string errorCode,
|
|
CancellationToken cancellationToken);
|
|
}
|
|
|
|
public sealed record ReconciliationLease(Guid RunId, Guid FenceToken);
|
|
|
|
public sealed record ReconciliationJobSnapshot(
|
|
Guid? RunId,
|
|
string State,
|
|
string? Reason,
|
|
DateTimeOffset? RequestedAt,
|
|
DateTimeOffset? StartedAt,
|
|
DateTimeOffset? CompletedAt,
|
|
int WorkOrdersProcessed,
|
|
int CommentsProcessed,
|
|
string? ErrorCode);
|
|
}
|