using System.Collections.Concurrent;
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Hubs;
///
/// Thread-safe in-memory implementation of .
/// Keyed by ; last write wins.
///
public sealed class InMemoryDriverStatusSnapshotStore : IDriverStatusSnapshotStore
{
private readonly ConcurrentDictionary _byInstance = new();
///
public void Upsert(DriverHealthChanged snapshot)
=> _byInstance[snapshot.DriverInstanceId] = snapshot;
///
public bool TryGet(string driverInstanceId, out DriverHealthChanged snapshot)
=> _byInstance.TryGetValue(driverInstanceId, out snapshot!);
}