From d9b5205cc2fe672c671a601ddb570f8a8151188a Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 13 Jun 2023 16:25:17 +0100 Subject: [PATCH] naming only: IsPatternBased -> IsPattern (also fix some remaining debug tests) --- docs/ReleaseNotes.md | 2 +- .../KeyspaceIsolation/KeyPrefixed.cs | 2 +- .../PublicAPI/PublicAPI.Shipped.txt | 2 +- src/StackExchange.Redis/RedisChannel.cs | 2 +- tests/StackExchange.Redis.Tests/ChannelTests.cs | 16 ++++++++-------- tests/StackExchange.Redis.Tests/FailoverTests.cs | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 70b49d1b6..9b79e7b1e 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -8,7 +8,7 @@ Current package versions: ## Unreleased -- Fix [#2479](https://github.com/StackExchange/StackExchange.Redis/issues/2479): Add `RedisChannel.UseImplicitAutoPattern` (global) and `RedisChannel.IsPatternBased` ([#2480 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2480)) +- Fix [#2479](https://github.com/StackExchange/StackExchange.Redis/issues/2479): Add `RedisChannel.UseImplicitAutoPattern` (global) and `RedisChannel.IsPattern` ([#2480 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2480)) - Fix [#2479](https://github.com/StackExchange/StackExchange.Redis/issues/2479): Mark `RedisChannel` conversion operators as obsolete; add `RedisChannel.Literal` and `RedisChannel.Pattern` helpers ([#2481 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2481)) - Fix [#2449](https://github.com/StackExchange/StackExchange.Redis/issues/2449): Update `Pipelines.Sockets.Unofficial` to `v2.2.8` to support native AOT ([#2456 by eerhardt](https://github.com/StackExchange/StackExchange.Redis/pull/2456)) diff --git a/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs b/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs index 3bad77d43..e34cad895 100644 --- a/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs +++ b/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs @@ -844,7 +844,7 @@ protected RedisValue SortGetToInner(RedisValue outer) => protected RedisChannel ToInner(RedisChannel outer) { var combined = RedisKey.ConcatenateBytes(Prefix, null, (byte[]?)outer); - return new RedisChannel(combined, outer.IsPatternBased ? RedisChannel.PatternMode.Pattern : RedisChannel.PatternMode.Literal); + return new RedisChannel(combined, outer.IsPattern ? RedisChannel.PatternMode.Pattern : RedisChannel.PatternMode.Literal); } private Func? mapFunction; diff --git a/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt b/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt index 464af8023..50ac23e75 100644 --- a/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt +++ b/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt @@ -1259,7 +1259,7 @@ StackExchange.Redis.Proxy.Twemproxy = 1 -> StackExchange.Redis.Proxy StackExchange.Redis.RedisChannel StackExchange.Redis.RedisChannel.Equals(StackExchange.Redis.RedisChannel other) -> bool StackExchange.Redis.RedisChannel.IsNullOrEmpty.get -> bool -StackExchange.Redis.RedisChannel.IsPatternBased.get -> bool +StackExchange.Redis.RedisChannel.IsPattern.get -> bool StackExchange.Redis.RedisChannel.PatternMode StackExchange.Redis.RedisChannel.PatternMode.Auto = 0 -> StackExchange.Redis.RedisChannel.PatternMode StackExchange.Redis.RedisChannel.PatternMode.Literal = 1 -> StackExchange.Redis.RedisChannel.PatternMode diff --git a/src/StackExchange.Redis/RedisChannel.cs b/src/StackExchange.Redis/RedisChannel.cs index 16d4e7107..5e9446506 100644 --- a/src/StackExchange.Redis/RedisChannel.cs +++ b/src/StackExchange.Redis/RedisChannel.cs @@ -19,7 +19,7 @@ namespace StackExchange.Redis /// /// Indicates whether this channel represents a wildcard pattern (see PSUBSCRIBE) /// - public bool IsPatternBased => _isPatternBased; + public bool IsPattern => _isPatternBased; internal bool IsNull => Value == null; diff --git a/tests/StackExchange.Redis.Tests/ChannelTests.cs b/tests/StackExchange.Redis.Tests/ChannelTests.cs index 3f11d2ef1..4843090f4 100644 --- a/tests/StackExchange.Redis.Tests/ChannelTests.cs +++ b/tests/StackExchange.Redis.Tests/ChannelTests.cs @@ -25,7 +25,7 @@ public void ValidateAutoPatternModeString(string name, bool useImplicitAutoPatte #pragma warning disable CS0618 // we need to test the operator RedisChannel channel = name; #pragma warning restore CS0618 - Assert.Equal(isPatternBased, channel.IsPatternBased); + Assert.Equal(isPatternBased, channel.IsPattern); } finally { @@ -53,7 +53,7 @@ public void ValidateModeSpecifiedIgnoresGlobalSetting(string name, RedisChannel. { RedisChannel.UseImplicitAutoPattern = useImplicitAutoPattern; RedisChannel channel = new(name, mode); - Assert.Equal(isPatternBased, channel.IsPatternBased); + Assert.Equal(isPatternBased, channel.IsPattern); } finally { @@ -76,7 +76,7 @@ public void ValidateAutoPatternModeBytes(string name, bool useImplicitAutoPatter #pragma warning disable CS0618 // we need to test the operator RedisChannel channel = bytes; #pragma warning restore CS0618 - Assert.Equal(isPatternBased, channel.IsPatternBased); + Assert.Equal(isPatternBased, channel.IsPattern); } finally { @@ -105,7 +105,7 @@ public void ValidateModeSpecifiedIgnoresGlobalSettingBytes(string name, RedisCha { RedisChannel.UseImplicitAutoPattern = useImplicitAutoPattern; RedisChannel channel = new(bytes, mode); - Assert.Equal(isPatternBased, channel.IsPatternBased); + Assert.Equal(isPatternBased, channel.IsPattern); } finally { @@ -128,21 +128,21 @@ public void ValidateLiteralPatternMode(string name, bool useImplicitAutoPattern) // literal, string channel = RedisChannel.Literal(name); - Assert.False(channel.IsPatternBased); + Assert.False(channel.IsPattern); // pattern, string channel = RedisChannel.Pattern(name); - Assert.True(channel.IsPatternBased); + Assert.True(channel.IsPattern); var bytes = Encoding.UTF8.GetBytes(name); // literal, byte[] channel = RedisChannel.Literal(bytes); - Assert.False(channel.IsPatternBased); + Assert.False(channel.IsPattern); // pattern, byte[] channel = RedisChannel.Pattern(bytes); - Assert.True(channel.IsPatternBased); + Assert.True(channel.IsPattern); } finally { diff --git a/tests/StackExchange.Redis.Tests/FailoverTests.cs b/tests/StackExchange.Redis.Tests/FailoverTests.cs index 53c7e74f4..e9ff75d9a 100644 --- a/tests/StackExchange.Redis.Tests/FailoverTests.cs +++ b/tests/StackExchange.Redis.Tests/FailoverTests.cs @@ -203,7 +203,7 @@ public async Task SubscriptionsSurviveConnectionFailureAsync() using var conn = (Create(allowAdmin: true, shared: false, log: Writer, syncTimeout: 1000) as ConnectionMultiplexer)!; var profiler = conn.AddProfiler(); - RedisChannel channel = Me(); + RedisChannel channel = RedisChannel.Literal(Me()); var sub = conn.GetSubscriber(); int counter = 0; Assert.True(sub.IsConnected()); @@ -308,7 +308,7 @@ public async Task SubscriptionsSurvivePrimarySwitchAsync() using var aConn = Create(allowAdmin: true, shared: false); using var bConn = Create(allowAdmin: true, shared: false); - RedisChannel channel = Me(); + RedisChannel channel = RedisChannel.Literal(Me()); Log("Using Channel: " + channel); var subA = aConn.GetSubscriber(); var subB = bConn.GetSubscriber();