feat(adminui): add DriverStatusSignalRBridge + InMemory snapshot store

This commit is contained in:
Joseph Doherty
2026-05-28 10:13:30 -04:00
parent 3f23a1acd3
commit 29370fde3c
5 changed files with 115 additions and 0 deletions
@@ -0,0 +1,21 @@
using System.Collections.Concurrent;
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Hubs;
/// <summary>
/// Thread-safe in-memory implementation of <see cref="IDriverStatusSnapshotStore"/>.
/// Keyed by <see cref="DriverHealthChanged.DriverInstanceId"/>; last write wins.
/// </summary>
public sealed class InMemoryDriverStatusSnapshotStore : IDriverStatusSnapshotStore
{
private readonly ConcurrentDictionary<string, DriverHealthChanged> _byInstance = new();
/// <inheritdoc />
public void Upsert(DriverHealthChanged snapshot)
=> _byInstance[snapshot.DriverInstanceId] = snapshot;
/// <inheritdoc />
public bool TryGet(string driverInstanceId, out DriverHealthChanged snapshot)
=> _byInstance.TryGetValue(driverInstanceId, out snapshot!);
}