feat(core): add IBatchSubscribable batch data-change contract
This commit is contained in:
@@ -51,3 +51,29 @@ public sealed record DataChangeEventArgs(
|
||||
ISubscriptionHandle SubscriptionHandle,
|
||||
string FullReference,
|
||||
DataValueSnapshot Snapshot);
|
||||
|
||||
/// <summary>One changed attribute within a <see cref="DataChangeBatchEventArgs"/>.</summary>
|
||||
/// <param name="FullReference">Driver-side full reference of the changed attribute.</param>
|
||||
/// <param name="Snapshot">New value + quality + timestamps.</param>
|
||||
public sealed record DataChangeItem(string FullReference, DataValueSnapshot Snapshot);
|
||||
|
||||
/// <summary>Event payload for <see cref="IBatchSubscribable.OnDataChangeBatch"/> — every attribute
|
||||
/// that changed within ONE production burst (a poll cycle, an inbound message, a stream chunk).</summary>
|
||||
/// <param name="SubscriptionHandle">The handle returned by the original <see cref="ISubscribable.SubscribeAsync"/> call.</param>
|
||||
/// <param name="Items">The changed attributes, one entry per changed tag. Never empty.</param>
|
||||
public sealed record DataChangeBatchEventArgs(
|
||||
ISubscriptionHandle SubscriptionHandle,
|
||||
IReadOnlyList<DataChangeItem> Items);
|
||||
|
||||
/// <summary>
|
||||
/// Optional driver capability: data changes delivered one event per production burst instead of
|
||||
/// one event per tag. A driver implementing this raises <see cref="OnDataChangeBatch"/> once per
|
||||
/// burst AND continues raising the per-tag <see cref="ISubscribable.OnDataChange"/> for each item
|
||||
/// (legacy consumers: Galaxy cold reads, driver CLIs). A consumer subscribes to EXACTLY ONE of the
|
||||
/// two events — subscribing both double-delivers. DriverInstanceActor prefers the batch event.
|
||||
/// </summary>
|
||||
public interface IBatchSubscribable : ISubscribable
|
||||
{
|
||||
/// <summary>Batched data-change notification — one raise per production burst.</summary>
|
||||
event EventHandler<DataChangeBatchEventArgs>? OnDataChangeBatch;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user