feat: execute post-baseline jetstream parity plan

This commit is contained in:
Joseph Doherty
2026-02-23 12:11:19 -05:00
parent c3763e83d6
commit b41e6ff320
58 changed files with 1430 additions and 102 deletions

View File

@@ -1,7 +1,12 @@
namespace NATS.Server.Subscriptions;
public sealed record RemoteSubscription(string Subject, string? Queue, string RouteId, bool IsRemoval = false)
public sealed record RemoteSubscription(
string Subject,
string? Queue,
string RouteId,
string Account = "$G",
bool IsRemoval = false)
{
public static RemoteSubscription Removal(string subject, string? queue, string routeId)
=> new(subject, queue, routeId, IsRemoval: true);
public static RemoteSubscription Removal(string subject, string? queue, string routeId, string account = "$G")
=> new(subject, queue, routeId, account, IsRemoval: true);
}

View File

@@ -102,7 +102,7 @@ public sealed class SubList : IDisposable
_lock.EnterWriteLock();
try
{
var key = $"{sub.RouteId}|{sub.Subject}|{sub.Queue}";
var key = $"{sub.RouteId}|{sub.Account}|{sub.Subject}|{sub.Queue}";
if (sub.IsRemoval)
_remoteSubs.Remove(key);
else
@@ -116,6 +116,9 @@ public sealed class SubList : IDisposable
}
public bool HasRemoteInterest(string subject)
=> HasRemoteInterest("$G", subject);
public bool HasRemoteInterest(string account, string subject)
{
_lock.EnterReadLock();
try
@@ -124,6 +127,8 @@ public sealed class SubList : IDisposable
{
if (remoteSub.IsRemoval)
continue;
if (!string.Equals(remoteSub.Account, account, StringComparison.Ordinal))
continue;
if (SubjectMatch.MatchLiteral(subject, remoteSub.Subject))
return true;