namespace ZB.MOM.WW.OtOpcUa.Configuration.LocalCache;
///
/// Per-node local cache of the most-recently-applied generation(s). Used to bootstrap the
/// address space when the central DB is unreachable (degraded-but-running).
///
///
/// Concurrency contract: implementations must serialize writes — specifically,
/// for the same (ClusterId, GenerationId) from concurrent
/// callers must not produce duplicate rows. Reads may run concurrently with reads and writes.
/// The implementation enforces this via an instance-level
/// around the find-then-insert/update window.
///
public interface ILocalConfigCache
{
/// Retrieves the most recent generation snapshot for the specified cluster.
/// The cluster identifier.
/// The cancellation token.
/// The most recent generation snapshot, or null if none exists.
Task GetMostRecentAsync(string clusterId, CancellationToken ct = default);
/// Stores a generation snapshot in the local cache.
/// The generation snapshot to store.
/// The cancellation token.
/// A task that represents the asynchronous operation.
Task PutAsync(GenerationSnapshot snapshot, CancellationToken ct = default);
/// Removes old generations, keeping only the most recent N.
/// The cluster identifier.
/// The number of latest generations to keep.
/// The cancellation token.
/// A task that represents the asynchronous operation.
Task PruneOldGenerationsAsync(string clusterId, int keepLatest = 10, CancellationToken ct = default);
}