release orchestrator v1 draft and build fixes
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StellaOps.Canonical.Json;
|
||||
using StellaOps.Determinism;
|
||||
using StellaOps.HybridLogicalClock;
|
||||
using StellaOps.Scheduler.Persistence;
|
||||
using StellaOps.Scheduler.Persistence.Postgres.Models;
|
||||
@@ -54,6 +55,8 @@ public sealed class BatchSnapshotService : IBatchSnapshotService
|
||||
private readonly BatchSnapshotSignerDelegate? _signer;
|
||||
private readonly BatchSnapshotVerifierDelegate? _verifier;
|
||||
private readonly ILogger<BatchSnapshotService> _logger;
|
||||
private readonly TimeProvider _timeProvider;
|
||||
private readonly IGuidProvider _guidProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new batch snapshot service.
|
||||
@@ -63,13 +66,17 @@ public sealed class BatchSnapshotService : IBatchSnapshotService
|
||||
IBatchSnapshotRepository snapshotRepository,
|
||||
ILogger<BatchSnapshotService> logger,
|
||||
BatchSnapshotSignerDelegate? signer = null,
|
||||
BatchSnapshotVerifierDelegate? verifier = null)
|
||||
BatchSnapshotVerifierDelegate? verifier = null,
|
||||
TimeProvider? timeProvider = null,
|
||||
IGuidProvider? guidProvider = null)
|
||||
{
|
||||
_logRepository = logRepository ?? throw new ArgumentNullException(nameof(logRepository));
|
||||
_snapshotRepository = snapshotRepository ?? throw new ArgumentNullException(nameof(snapshotRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_signer = signer;
|
||||
_verifier = verifier;
|
||||
_timeProvider = timeProvider ?? TimeProvider.System;
|
||||
_guidProvider = guidProvider ?? SystemGuidProvider.Instance;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -105,13 +112,13 @@ public sealed class BatchSnapshotService : IBatchSnapshotService
|
||||
// Create snapshot
|
||||
var snapshot = new BatchSnapshot
|
||||
{
|
||||
BatchId = Guid.NewGuid(),
|
||||
BatchId = _guidProvider.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
RangeStartT = startT,
|
||||
RangeEndT = endT,
|
||||
HeadLink = headLink,
|
||||
JobCount = jobs.Count,
|
||||
CreatedAt = DateTimeOffset.UtcNow
|
||||
CreatedAt = _timeProvider.GetUtcNow()
|
||||
};
|
||||
|
||||
// Sign if requested and signer available
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed class HlcSchedulerEnqueueService : IHlcSchedulerEnqueueService
|
||||
private readonly ISchedulerLogRepository _logRepository;
|
||||
private readonly IChainHeadRepository _chainHeadRepository;
|
||||
private readonly ILogger<HlcSchedulerEnqueueService> _logger;
|
||||
private readonly TimeProvider _timeProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new HLC scheduler enqueue service.
|
||||
@@ -35,12 +36,14 @@ public sealed class HlcSchedulerEnqueueService : IHlcSchedulerEnqueueService
|
||||
IHybridLogicalClock hlc,
|
||||
ISchedulerLogRepository logRepository,
|
||||
IChainHeadRepository chainHeadRepository,
|
||||
ILogger<HlcSchedulerEnqueueService> logger)
|
||||
ILogger<HlcSchedulerEnqueueService> logger,
|
||||
TimeProvider? timeProvider = null)
|
||||
{
|
||||
_hlc = hlc ?? throw new ArgumentNullException(nameof(hlc));
|
||||
_logRepository = logRepository ?? throw new ArgumentNullException(nameof(logRepository));
|
||||
_chainHeadRepository = chainHeadRepository ?? throw new ArgumentNullException(nameof(chainHeadRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_timeProvider = timeProvider ?? TimeProvider.System;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -124,7 +127,7 @@ public sealed class HlcSchedulerEnqueueService : IHlcSchedulerEnqueueService
|
||||
PayloadHash = payloadHash,
|
||||
PrevLink = prevLink,
|
||||
Link = link,
|
||||
CreatedAt = DateTimeOffset.UtcNow // Database will set actual value
|
||||
CreatedAt = _timeProvider.GetUtcNow() // Database will set actual value
|
||||
};
|
||||
|
||||
await _logRepository.InsertWithChainUpdateAsync(entry, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user