Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

naming only: IsPatternBased -> IsPattern #2482

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RedisKey, RedisKey>? mapFunction;
Expand Down
2 changes: 1 addition & 1 deletion src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/StackExchange.Redis/RedisChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace StackExchange.Redis
/// <summary>
/// Indicates whether this channel represents a wildcard pattern (see <c>PSUBSCRIBE</c>)
/// </summary>
public bool IsPatternBased => _isPatternBased;
public bool IsPattern => _isPatternBased;

internal bool IsNull => Value == null;

Expand Down
16 changes: 8 additions & 8 deletions tests/StackExchange.Redis.Tests/ChannelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions tests/StackExchange.Redis.Tests/FailoverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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();
Expand Down