diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryPaging.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryPaging.cs
index b07a79641..c36c552b3 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryPaging.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryPaging.cs
@@ -77,6 +77,8 @@ namespace ZB.MOM.WW.OtOpcUa.OpcUaServer;
/// With , the node the cursor was issued for — re-keyed by the H1 history
/// port from the SDK NodeId string to (realm, identifier), so a cursor never depends on an SDK handle.
/// The node's identifier in ; required on every production cursor.
+/// The node's binding discriminator ( — the namespace URI
+/// locally, a view tag for a peer); the realm alone folds namespaces, so a cursor is bound to this too.
/// The topology generation. A removal conservatively invalidates all cursors.
internal sealed record HistoryContinuationState(
string Tagname,
@@ -95,6 +97,7 @@ internal sealed record HistoryContinuationState(
bool WithinTieCluster = false,
AddressSpaceRealm BoundRealm = default,
string? BoundIdentifier = null,
+ string? BoundTag = null,
long AddressSpaceEpoch = -1)
{
/// The walk-back hint this cursor carries.
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs
index 1f8c65661..53a57d358 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/HistoryReadPort.cs
@@ -94,11 +94,22 @@ internal sealed record HistoryReadAtTimeVariant(IReadOnlyList Timestam
/// The node's s= identifier in that realm.
/// The inbound continuation point; null/empty = a fresh read.
/// Processed only: the requested aggregate function's NodeId.
+///
+/// An opaque discriminator a continuation is bound to on top of (realm, identifier), because the realm folds
+/// namespaces (mapped/raw → Raw, every other index → Uns): the SDK adapter passes the node's namespace URI
+/// (), a peer (H2) its view tag (mapping id / kind). Compared ordinally;
+/// a cursor issued under one tag never resumes under another.
+///
+/// The local adapter's original NodeId, for log lines only (never used to resolve or bind).
internal readonly record struct HistoryReadPortItem(
- AddressSpaceRealm Realm, string Identifier, byte[]? ContinuationPoint = null, NodeId AggregateType = default)
+ AddressSpaceRealm Realm, string Identifier, byte[]? ContinuationPoint = null, NodeId AggregateType = default,
+ string? BindingTag = null, NodeId NodeId = default)
{
- /// The node, for log lines (Realm:Identifier).
- public override string ToString() => $"{Realm}:{Identifier}";
+ /// What a log line names the node as: the original NodeId when the SDK adapter supplied it, else Realm:Identifier.
+ public object LogNodeId => NodeId.IsNull ? $"{Realm}:{Identifier}" : NodeId;
+
+ ///
+ public override string ToString() => LogNodeId.ToString()!;
}
///
@@ -145,8 +156,9 @@ internal sealed class HistoryReadNodeOutcome
/// The node's identifier.
/// The history (address-space) epoch the cursor was issued under.
/// The request details (a peer binds their hash; the SDK session store ignores them).
+/// The item's .
internal readonly record struct HistoryContinuationBinding(
- AddressSpaceRealm Realm, string Identifier, long Epoch, HistoryReadVariant? Details);
+ AddressSpaceRealm Realm, string Identifier, long Epoch, HistoryReadVariant? Details, string? Tag = null);
///
/// Where the port stores and takes resume state for one caller. The local SDK path binds it to the OPC UA session
@@ -361,7 +373,8 @@ public sealed partial class OtOpcUaNodeManager
// AggregateType is a per-node parallel collection (same length as nodesToRead, enforced by the base
// dispatcher); handle.Index is the node's position in it.
items[i] = new HistoryReadPortItem(key.Realm, key.Id, cp.Length > 0 ? cp.ToArray() : null,
- variant is HistoryReadProcessedVariant ? aggregates[handle.Index] : default);
+ variant is HistoryReadProcessedVariant ? aggregates[handle.Index] : default,
+ HistoryBindingTag(handle.NodeId), handle.NodeId);
}
var outcomes = ReadHistory(variant, items, SessionHistoryContinuationScope(context.OperationContext?.Session),
@@ -374,6 +387,17 @@ public sealed partial class OtOpcUaNodeManager
}
}
+ ///
+ /// The continuation binding tag of a local node: its namespace URI. With (realm, identifier) it is the same
+ /// identity the pre-port cursor bound (the namespace-qualified NodeId string), so a cursor of a raw node never resumes
+ /// on the same identifier in the mapped/raw namespace, nor the reverse.
+ ///
+ /// The node.
+ /// The namespace URI, or ns=<index> for an unregistered index.
+ internal string HistoryBindingTag(NodeId nodeId) =>
+ Server.NamespaceUris.GetString(nodeId.NamespaceIndex)
+ ?? "ns=" + nodeId.NamespaceIndex.ToString(System.Globalization.CultureInfo.InvariantCulture);
+
/// The continuation scope of a local OPC UA session — the SDK session store, as before the port.
/// The request's session; null on the session-less in-process path.
/// A scope reading at each call.
@@ -417,18 +441,20 @@ public sealed partial class OtOpcUaNodeManager
/// single-shot for that node, as before.
///
private byte[]? SaveHistoryContinuation(
- IHistoryContinuationScope scope, AddressSpaceRealm realm, string identifier, long epoch,
+ IHistoryContinuationScope scope, AddressSpaceRealm realm, string identifier, string? tag, long epoch,
HistoryReadVariant? details, HistoryContinuationState state)
{
if (epoch != Volatile.Read(ref _historyContinuationEpoch)) return null;
- return scope.Save(state with { BoundRealm = realm, BoundIdentifier = identifier, AddressSpaceEpoch = epoch },
- new HistoryContinuationBinding(realm, identifier, epoch, details));
+ return scope.Save(state with { BoundRealm = realm, BoundIdentifier = identifier, BoundTag = tag, AddressSpaceEpoch = epoch },
+ new HistoryContinuationBinding(realm, identifier, epoch, details, tag));
}
- /// Whether a taken cursor was issued for this node, in this realm, under this epoch.
- private static bool HistoryContinuationMatches(HistoryContinuationState state, AddressSpaceRealm realm, string identifier, long epoch) =>
+ /// Whether a taken cursor was issued for this node (realm, identifier and binding tag) under this epoch.
+ private static bool HistoryContinuationMatches(
+ HistoryContinuationState state, AddressSpaceRealm realm, string identifier, string? tag, long epoch) =>
state.BoundIdentifier is not null && state.BoundRealm == realm
- && string.Equals(state.BoundIdentifier, identifier, StringComparison.Ordinal) && state.AddressSpaceEpoch == epoch;
+ && string.Equals(state.BoundIdentifier, identifier, StringComparison.Ordinal)
+ && string.Equals(state.BoundTag, tag, StringComparison.Ordinal) && state.AddressSpaceEpoch == epoch;
/// The SDK session store behind a scope (read per call, so a test's store swap applies to the next call).
private sealed class SessionScope(OtOpcUaNodeManager nm, ISession? session) : IHistoryContinuationScope
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/OtOpcUaNodeManager.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/OtOpcUaNodeManager.cs
index 69633e2f0..e744e10a4 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/OtOpcUaNodeManager.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/OtOpcUaNodeManager.cs
@@ -9036,7 +9036,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
var state = _historyContinuationStore.TryTake(session, inboundCp.ToArray());
// A point is bound to the node that issued it: another node's source name is a miss too.
var boundKey = MapKey(handle.NodeId);
- if (state is null || !HistoryContinuationMatches(state, boundKey.Realm, boundKey.Id, historyEpoch) || state.Kind != HistoryCursorKind.Events || state.Tagname != sourceName)
+ if (state is null || !HistoryContinuationMatches(state, boundKey.Realm, boundKey.Id, HistoryBindingTag(handle.NodeId), historyEpoch) || state.Kind != HistoryCursorKind.Events || state.Tagname != sourceName)
{
errors[handle.Index] = StatusCodes.BadContinuationPointInvalid;
results[handle.Index] = new SdkHistoryReadResult { StatusCode = StatusCodes.BadContinuationPointInvalid };
@@ -9214,7 +9214,8 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
var historyEvent = ProjectEvents(events, selectClauses, where, filterContext);
var eventsKey = MapKey(handle.NodeId);
var outboundCp = pendingCursor is null ? null : SaveHistoryContinuation(
- SessionHistoryContinuationScope(session), eventsKey.Realm, eventsKey.Id, historyEpoch, details: null, pendingCursor);
+ SessionHistoryContinuationScope(session), eventsKey.Realm, eventsKey.Id, HistoryBindingTag(handle.NodeId), historyEpoch,
+ details: null, pendingCursor);
results[handle.Index] = new SdkHistoryReadResult
{
// No events ⇒ GoodNoData (the notifier is historized, the window just held no events — or none matched).
@@ -10119,8 +10120,8 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
{
// Resume read: take the stored cursor. A miss (unknown / evicted / malformed point) ⇒
// BadContinuationPointInvalid for THIS node.
- var state = continuations.TryTake(inboundCp, new HistoryContinuationBinding(handle.Realm, handle.Identifier, historyEpoch, details));
- if (state is null || !HistoryContinuationMatches(state, handle.Realm, handle.Identifier, historyEpoch) || state.Kind != HistoryCursorKind.Raw
+ var state = continuations.TryTake(inboundCp, new HistoryContinuationBinding(handle.Realm, handle.Identifier, historyEpoch, details, handle.BindingTag));
+ if (state is null || !HistoryContinuationMatches(state, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch) || state.Kind != HistoryCursorKind.Raw
|| !TryGetHistorizedTagname(handle.Identifier, out var boundTag, handle.Realm) || boundTag != state.Tagname)
{
outcome.Error = StatusCodes.BadContinuationPointInvalid;
@@ -10187,7 +10188,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
return null;
}
- return SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, historyEpoch, details, new HistoryContinuationState(
+ return SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch, details, new HistoryContinuationState(
tagname, previous, endUtc, 0, numValuesPerNode, SegmentWidthTicks: walkHint.WidthTicks,
EmptyFromTicks: walkHint.EmptyFromTicks, EmptyToTicks: walkHint.EmptyToTicks,
PendingEndBound: HistoryBounds.Carry(endBound!, page)! with { DataExhausted = true }));
@@ -10253,7 +10254,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
if (startBound is not null && numValuesPerNode == 1 && anything)
{
// The page is the start bound alone; the data starts at StartTime on the next page.
- var boundOnlyCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, historyEpoch, details, new HistoryContinuationState(
+ var boundOnlyCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch, details, new HistoryContinuationState(
tagname, startUtc, endUtc, 0, numValuesPerNode, SegmentWidthTicks: walkHint.WidthTicks,
EmptyFromTicks: walkHint.EmptyFromTicks, EmptyToTicks: walkHint.EmptyToTicks,
PendingEndBound: HistoryBounds.Carry(pending, [startBound])));
@@ -10440,7 +10441,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
EmptyFromTicks: walkHint.EmptyFromTicks, EmptyToTicks: walkHint.EmptyToTicks,
PendingEndBound: HistoryBounds.Carry(endBound, slice),
WithinTieCluster: resumeAt == startUtc);
- clusterCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, historyEpoch, details, clusterState);
+ clusterCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch, details, clusterState);
}
else if (endBound is not null)
{
@@ -10495,7 +10496,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
{
// Save may return null (no session on this request) ⇒ degrade to single-shot for this node.
// Built AFTER historyData so a failure projecting samples can never orphan a stored cursor.
- outboundCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, historyEpoch, details, nextState);
+ outboundCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch, details, nextState);
}
else if (endBound is not null)
{
@@ -10595,8 +10596,8 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
HistoryModifiedCursor? resumeAfter = null;
if (inboundCp is { Length: > 0 })
{
- var state = continuations.TryTake(inboundCp, new HistoryContinuationBinding(handle.Realm, handle.Identifier, historyEpoch, details));
- if (state is null || !HistoryContinuationMatches(state, handle.Realm, handle.Identifier, historyEpoch) || state.Kind != HistoryCursorKind.Modified || state.Tagname != tagname)
+ var state = continuations.TryTake(inboundCp, new HistoryContinuationBinding(handle.Realm, handle.Identifier, historyEpoch, details, handle.BindingTag));
+ if (state is null || !HistoryContinuationMatches(state, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch) || state.Kind != HistoryCursorKind.Modified || state.Tagname != tagname)
{
outcome.Error = StatusCodes.BadContinuationPointInvalid;
outcome.Result = new SdkHistoryReadResult { StatusCode = StatusCodes.BadContinuationPointInvalid };
@@ -10626,7 +10627,7 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
if (page.HasMore && numValuesPerNode > 0 && page.Values.Count > 0)
{
var last = page.Values[^1];
- outboundCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, historyEpoch, details, new HistoryContinuationState(
+ outboundCp = SaveHistoryContinuation(continuations, handle.Realm, handle.Identifier, handle.BindingTag, historyEpoch, details, new HistoryContinuationState(
tagname, last.SourceTimeUtc, endUtc, 0, numValuesPerNode,
HistoryCursorKind.Modified, last.ModifiedId, startUtc));
}
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/PeerHistoryContinuationStore.cs b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/PeerHistoryContinuationStore.cs
index fb3400203..8b09a7714 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/PeerHistoryContinuationStore.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer/PeerHistoryContinuationStore.cs
@@ -13,9 +13,10 @@ namespace ZB.MOM.WW.OtOpcUa.OpcUaServer;
/// The history (address-space) epoch.
/// The view's realm.
/// The view's identifier.
+/// The view's binding tag ().
/// The of the request.
internal readonly record struct PeerHistoryContinuationKey(
- string Principal, string ServingIncarnation, long Epoch, AddressSpaceRealm Realm, string Identifier, string DetailsHash);
+ string Principal, string ServingIncarnation, long Epoch, AddressSpaceRealm Realm, string Identifier, string? BindingTag, string DetailsHash);
///
/// The ORIGIN-side store for remote peers' HistoryRead continuation points (gRPC data history plan §3.2, phase H1;
@@ -123,7 +124,7 @@ internal sealed class PeerHistoryContinuationStore
var token = RandomNumberGenerator.GetBytes(TokenLength);
var key = new PeerHistoryContinuationKey(
- principal, servingIncarnation, state.AddressSpaceEpoch, state.BoundRealm, state.BoundIdentifier, detailsHash);
+ principal, servingIncarnation, state.AddressSpaceEpoch, state.BoundRealm, state.BoundIdentifier, state.BoundTag, detailsHash);
lock (_gate)
{
var now = _clock.GetTimestamp();
@@ -214,6 +215,6 @@ internal sealed class PeerHistoryContinuationScope(
///
public HistoryContinuationState? TryTake(byte[] continuationPoint, HistoryContinuationBinding binding) =>
store.TryTake(continuationPoint, new PeerHistoryContinuationKey(
- principal, currentServingIncarnation(), binding.Epoch, binding.Realm, binding.Identifier,
+ principal, currentServingIncarnation(), binding.Epoch, binding.Realm, binding.Identifier, binding.Tag,
binding.Details?.ComputeDetailsHash() ?? string.Empty));
}
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs
index 8eca6ee8e..c53ad12f8 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortPagingFuzzTests.cs
@@ -164,7 +164,7 @@ public sealed class HistoryReadPortPagingFuzzTests(HistoryReadPortServerFixture
private (uint Status, List Values, byte[]? Cp) PortRead(HistoryReadRawVariant details, AddressSpaceRealm realm, string id, byte[]? cp)
{
- var outcome = fx.Nm.ReadHistory(details, [new HistoryReadPortItem(realm, id, cp)],
+ var outcome = fx.Nm.ReadHistory(details, [new HistoryReadPortItem(realm, id, cp, BindingTag: fx.Nm.HistoryBindingTag(fx.Nodes["dbl"].NodeId))],
fx.Nm.SessionHistoryContinuationScope(session: null), CancellationToken.None)[0];
// The operation slot, as the override's errors[i] (Status folds GoodNoData in; pinned by the parity tests).
return (outcome.Error?.StatusCode.Code ?? StatusCodes.BadHistoryOperationUnsupported.Code,
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs
index 623a3a315..e0ad26cfc 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/HistoryReadPortParityTests.cs
@@ -410,6 +410,38 @@ public sealed class HistoryReadPortParityTests(HistoryReadPortServerFixture fx)
});
}
+ [Fact]
+ public async Task A_cursor_is_bound_to_its_namespace_not_only_realm_and_identifier()
+ {
+ await RunAsync(async () =>
+ {
+ var source = new ParitySource();
+ source.Series["P.raw"] = Enumerable.Range(0, 6).Select(i => S((double)i, i)).ToList();
+ fx.Nm.HistorianDataSource = source;
+ var (realm, id, nodeId) = fx.Nodes["raw"];
+ var details = new HistoryReadRawVariant(T(0), T(100), 2, ReturnBounds: false);
+ var local = fx.Nm.HistoryBindingTag(nodeId);
+ // mapped/raw folds into the Raw realm: the same (Raw, identifier) in the projected namespace is ANOTHER node.
+ var mapped = ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections.ProjectedDataIds.RawNamespaceUri;
+ local.ShouldNotBe(mapped);
+ var scope = fx.Nm.SessionHistoryContinuationScope(session: null);
+
+ HistoryReadNodeOutcome Read(string tag, byte[]? cp) =>
+ fx.Nm.ReadHistory(details, [new HistoryReadPortItem(realm, id, cp, BindingTag: tag)], scope, CancellationToken.None)[0];
+
+ Read(mapped, Read(local, null).ContinuationPoint).Status.Code.ShouldBe(StatusCodes.BadContinuationPointInvalid.Code);
+ Read(local, Read(mapped, null).ContinuationPoint).Status.Code.ShouldBe(StatusCodes.BadContinuationPointInvalid.Code);
+ Read(local, Read(local, null).ContinuationPoint).Status.Code.ShouldBe(StatusCodes.Good.Code);
+
+ // The SDK adapter tags with the same value: an override-issued cursor resumes through the port with the local
+ // tag and is refused with the mapped one.
+ var sdk = Raw(T(0), T(100), 2, bounds: false);
+ Read(local, ReadOverrideRaw(sdk, "raw", null).Cp).Status.Code.ShouldBe(StatusCodes.Good.Code);
+ Read(mapped, ReadOverrideRaw(sdk, "raw", null).Cp).Status.Code.ShouldBe(StatusCodes.BadContinuationPointInvalid.Code);
+ await Task.CompletedTask;
+ });
+ }
+
[Fact]
public async Task The_outcome_status_carries_GoodNoData_and_Bad_operation_statuses_verbatim()
{
@@ -509,7 +541,8 @@ public sealed class HistoryReadPortParityTests(HistoryReadPortServerFixture fx)
{
var items = nodes.Select((n, i) => new HistoryReadPortItem(
fx.Nodes[n.Key].Realm, fx.Nodes[n.Key].Id, n.Cp,
- details is ReadProcessedDetails p ? p.AggregateType[i] : default)).ToArray();
+ details is ReadProcessedDetails p ? p.AggregateType[i] : default,
+ BindingTag: fx.Nm.HistoryBindingTag(fx.Nodes[n.Key].NodeId), NodeId: fx.Nodes[n.Key].NodeId)).ToArray();
var outcomes = fx.Nm.ReadHistory(HistoryReadVariant.From(details), items,
fx.Nm.SessionHistoryContinuationScope(session: null), CancellationToken.None);
// A slot the port leaves unset is the one the SDK seeded before the override ran (an empty, Good result).
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/PeerHistoryContinuationStoreTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/PeerHistoryContinuationStoreTests.cs
index 03c19af50..e9127b8e2 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/PeerHistoryContinuationStoreTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/PeerHistoryContinuationStoreTests.cs
@@ -20,13 +20,14 @@ public sealed class PeerHistoryContinuationStoreTests
private static HistoryContinuationState State(string identifier = "Plant/dev/t1", long epoch = 3, AddressSpaceRealm realm = AddressSpaceRealm.Raw) =>
new("WW.T1", DateTime.UnixEpoch, DateTime.UnixEpoch.AddDays(1), 0, 10)
{
- BoundRealm = realm, BoundIdentifier = identifier, AddressSpaceEpoch = epoch,
+ BoundRealm = realm, BoundIdentifier = identifier, BoundTag = "view-1", AddressSpaceEpoch = epoch,
};
private static PeerHistoryContinuationKey Key(
string principal = Principal, string incarnation = Incarnation, long epoch = 3,
- AddressSpaceRealm realm = AddressSpaceRealm.Raw, string identifier = "Plant/dev/t1", string hash = Hash) =>
- new(principal, incarnation, epoch, realm, identifier, hash);
+ AddressSpaceRealm realm = AddressSpaceRealm.Raw, string identifier = "Plant/dev/t1", string hash = Hash,
+ string? tag = "view-1") =>
+ new(principal, incarnation, epoch, realm, identifier, tag, hash);
private static PeerHistoryContinuationStore Store(int capacity = 8, ManualClock? clock = null, TimeSpan? idle = null) =>
new(Principal, Incarnation, capacity, idle, clock ?? new ManualClock());
@@ -63,6 +64,8 @@ public sealed class PeerHistoryContinuationStoreTests
("epoch bump", Key(epoch: 4)),
("realm", Key(realm: AddressSpaceRealm.Uns)),
("identifier", Key(identifier: "Plant/dev/t2")),
+ ("binding tag", Key(tag: "view-2")),
+ ("no binding tag", Key(tag: null)),
("details hash", Key(hash: "hash-b")),
};
foreach (var (name, key) in cases)
@@ -209,7 +212,7 @@ public sealed class PeerHistoryContinuationStoreTests
var store = Store();
var scope = new PeerHistoryContinuationScope(store, Principal, () => Incarnation);
var details = new HistoryReadRawVariant(DateTime.UnixEpoch, DateTime.UnixEpoch.AddHours(1), 10, ReturnBounds: false);
- var binding = new HistoryContinuationBinding(AddressSpaceRealm.Raw, "Plant/dev/t1", 3, details);
+ var binding = new HistoryContinuationBinding(AddressSpaceRealm.Raw, "Plant/dev/t1", 3, details, Tag: "view-1");
var token = scope.Save(State(), binding)!;
scope.TryTake(token, binding with { Details = details with { NumValuesPerNode = 11 } }).ShouldBeNull("other details");
@@ -230,7 +233,7 @@ public sealed class PeerHistoryContinuationStoreTests
var incarnation = Incarnation;
var scope = new PeerHistoryContinuationScope(store, Principal, () => incarnation);
var binding = new HistoryContinuationBinding(AddressSpaceRealm.Raw, "Plant/dev/t1", 3,
- new HistoryReadRawVariant(DateTime.UnixEpoch, DateTime.UnixEpoch.AddHours(1), 10, ReturnBounds: false));
+ new HistoryReadRawVariant(DateTime.UnixEpoch, DateTime.UnixEpoch.AddHours(1), 10, ReturnBounds: false), Tag: "view-1");
var token = scope.Save(State(), binding)!;
incarnation = "inc-2";
@@ -246,7 +249,7 @@ public sealed class PeerHistoryContinuationStoreTests
var store = Store();
var owner = new PeerHistoryContinuationScope(store, Principal, () => Incarnation);
var other = new PeerHistoryContinuationScope(store, "someone-else", () => Incarnation);
- var binding = new HistoryContinuationBinding(AddressSpaceRealm.Raw, "Plant/dev/t1", 3, null);
+ var binding = new HistoryContinuationBinding(AddressSpaceRealm.Raw, "Plant/dev/t1", 3, null, Tag: "view-1");
Should.Throw(() => other.Save(State(), binding), "a store never holds another principal's cursor");
var token = owner.Save(State(), binding)!;