using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
namespace ZB.MOM.WW.OtOpcUa.Runtime.Historian;
///
/// An whose per-write completion work can be done ONCE per drain pass instead of
/// once per tag group — QuestDB's WAL visibility wait, which a backend needs so that an immediate redelivery's
/// insert-if-absent check sees the rows just written. The continuous-historization recorder writes every group of a
/// pass with and then calls once, after every group
/// has reported and before it acks the pass.
///
///
/// The cancellation contract is the recorder's for both members: a cancellation of the caller's token (the pass) is
/// rethrown; any other failure of a write is false. A failure does not fail the pass —
/// the rows are committed; only their visibility to the next pass is unproven.
///
public interface IHistorianPassWriter : IHistorianValueWriter
{
///
/// Writes a batch of live values for a single tag as part of a drain pass, deferring the per-write completion
/// work to . Same result contract as .
///
/// Fully-qualified historian tag the values are recorded against.
/// The samples to write, in append order.
/// The pass's cancellation token.
/// true when the backend stored the batch; false on a retryable failure.
Task WriteLiveValuesInPassAsync(string tag, IReadOnlyList values, CancellationToken ct);
///
/// Completes the pass: does the deferred completion work for every write since the last flush (QuestDB: one WAL
/// visibility wait). A no-op when nothing was written.
///
/// The pass's cancellation token.
/// A task that completes when the pass's writes are visible (or the wait gave up).
Task FlushAsync(CancellationToken ct);
}