feat: execute post-baseline jetstream parity plan
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user