63c16d6912
Phase 4 of the ClusterClient -> gRPC migration deleted the Akka transports but left the naming behind: `ClusterClientSiteAuditClient` was transport- agnostic and worked unchanged, so it survived the deletion under a name that now describes a transport the repo no longer has. Same for a scatter of doc-comments still framing gRPC as "the new transport" beside an Akka one that is gone. Renames it to `SiteCommunicationAuditClient` (and its test file) and rewrites the stale comments to describe the single transport that exists. Also tightens CLAUDE.md: drops the self-describing directory listing and the 27-component enumeration in favour of the non-obvious parts only. Behaviour-neutral: names and prose only. Recorded as the Phase 4 follow-up in docs/plans/2026-07-22-clusterclient-to-grpc-plan.md.
51 lines
2.1 KiB
C#
51 lines
2.1 KiB
C#
using ZB.MOM.WW.ScadaBridge.Communication.Grpc;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Site.Telemetry;
|
|
|
|
/// <summary>
|
|
/// Default <see cref="ISiteStreamAuditClient"/> registered by
|
|
/// <see cref="ZB.MOM.WW.ScadaBridge.AuditLog.ServiceCollectionExtensions.AddAuditLog"/>.
|
|
/// It is a no-op binding for composition roots that have no
|
|
/// <c>SiteCommunicationActor</c> — central and test roots. Site roles override
|
|
/// it in the Host with <see cref="SiteCommunicationAuditClient"/>, which
|
|
/// actually forwards audit telemetry to central.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Returns an empty <see cref="IngestAck"/> so the
|
|
/// <see cref="SiteAuditTelemetryActor"/> doesn't flip any rows to
|
|
/// <c>Forwarded</c> when this NoOp is in effect — rows stay <c>Pending</c>
|
|
/// until a real client (or a test stub) takes over.
|
|
/// </para>
|
|
/// <para>
|
|
/// Audit-write paths are best-effort by contract: a NoOp client keeps the
|
|
/// host running cleanly and is consistent with "audit-write failures never
|
|
/// abort the user-facing action".
|
|
/// </para>
|
|
/// </remarks>
|
|
public sealed class NoOpSiteStreamAuditClient : ISiteStreamAuditClient
|
|
{
|
|
private static readonly IngestAck EmptyAck = new();
|
|
|
|
/// <inheritdoc/>
|
|
public Task<IngestAck> IngestAuditEventsAsync(AuditEventBatch batch, CancellationToken ct)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(batch);
|
|
// Empty ack — no EventIds will be flipped to Forwarded, so rows stay
|
|
// Pending until the real SiteCommunicationAuditClient (or a test stub)
|
|
// takes over.
|
|
return Task.FromResult(EmptyAck);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public Task<IngestAck> IngestCachedTelemetryAsync(CachedTelemetryBatch batch, CancellationToken ct)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(batch);
|
|
// Empty ack — same rationale as IngestAuditEventsAsync. The site still
|
|
// writes the audit + tracking rows to its SQLite stores authoritatively;
|
|
// central-side state only materialises once the real
|
|
// SiteCommunicationAuditClient (or a test stub) is wired in.
|
|
return Task.FromResult(EmptyAck);
|
|
}
|
|
}
|