From f8db01fd7f3fa6cc7b54ee4c7a41c45632147fa9 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 25 Jun 2026 02:04:52 -0400 Subject: [PATCH] feat(grpc): add RunWriteOnSession seam for write-reuse spike --- ...HistorianGrpcHistoricalWriteOrchestrator.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/AVEVA.Historian.Client/Grpc/HistorianGrpcHistoricalWriteOrchestrator.cs b/src/AVEVA.Historian.Client/Grpc/HistorianGrpcHistoricalWriteOrchestrator.cs index effc7c4..b2f9c86 100644 --- a/src/AVEVA.Historian.Client/Grpc/HistorianGrpcHistoricalWriteOrchestrator.cs +++ b/src/AVEVA.Historian.Client/Grpc/HistorianGrpcHistoricalWriteOrchestrator.cs @@ -47,6 +47,24 @@ internal sealed class HistorianGrpcHistoricalWriteOrchestrator HistorianGrpcHandshake.Session session = HistorianGrpcHandshake.OpenSession( connection, _options, cancellationToken, connectionMode: HistorianWcfAuthChainHelper.NativeIntegratedWriteEnabledConnectionMode); + return RunWriteOnSession(connection, session, tag, values, cancellationToken); + } + + // Spike/Phase-1 seam (A1): run the historical write against an EXTERNALLY-supplied, already- + // authenticated write-enabled (0x401) connection + session — NO Create()/handshake here. Run() + // delegates so the per-call path and the reuse path share one write implementation (DRY). + internal bool RunWriteOnSession( + HistorianGrpcConnection connection, + HistorianGrpcHandshake.Session session, + string tag, + IReadOnlyList values, + CancellationToken cancellationToken) + { + if (values.Count == 0) + { + return true; + } + string handle = session.StringHandle; DateTime Deadline() => DateTime.UtcNow.Add(_options.RequestTimeout);