Skip to content

Commit cd07b0d

Browse files
authored
Merge branch 'ssubscribe' into sharded-proposal
2 parents 1245a4b + 0172e03 commit cd07b0d

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/StackExchange.Redis/PhysicalConnection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,18 +1697,21 @@ private void MatchResult(in RawResult result)
16971697
_readStatus = ReadStatus.PubSubPMessage;
16981698

16991699
var channel = items[2].AsRedisChannel(ChannelPrefix, RedisChannel.RedisChannelOptions.Pattern);
1700+
17001701
Trace("PMESSAGE: " + channel);
17011702
if (!channel.IsNull)
17021703
{
17031704
if (TryGetPubSubPayload(items[3], out var payload))
17041705
{
17051706
var sub = items[1].AsRedisChannel(ChannelPrefix, RedisChannel.RedisChannelOptions.Pattern);
1707+
17061708
_readStatus = ReadStatus.InvokePubSub;
17071709
muxer.OnMessage(sub, channel, payload);
17081710
}
17091711
else if (TryGetMultiPubSubPayload(items[3], out var payloads))
17101712
{
17111713
var sub = items[1].AsRedisChannel(ChannelPrefix, RedisChannel.RedisChannelOptions.Pattern);
1714+
17121715
_readStatus = ReadStatus.InvokePubSub;
17131716
muxer.OnMessage(sub, channel, payloads);
17141717
}

src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,9 @@ StackExchange.Redis.RedisChannel.PatternMode.Auto = 0 -> StackExchange.Redis.Red
13151315
StackExchange.Redis.RedisChannel.PatternMode.Literal = 1 -> StackExchange.Redis.RedisChannel.PatternMode
13161316
StackExchange.Redis.RedisChannel.PatternMode.Pattern = 2 -> StackExchange.Redis.RedisChannel.PatternMode
13171317
StackExchange.Redis.RedisChannel.RedisChannel() -> void
1318+
StackExchange.Redis.RedisChannel.RedisChannel(byte[]? value, bool isSharded) -> void
13181319
StackExchange.Redis.RedisChannel.RedisChannel(byte[]? value, StackExchange.Redis.RedisChannel.PatternMode mode) -> void
1320+
StackExchange.Redis.RedisChannel.RedisChannel(string! value, bool isSharded) -> void
13191321
StackExchange.Redis.RedisChannel.RedisChannel(string! value, StackExchange.Redis.RedisChannel.PatternMode mode) -> void
13201322
StackExchange.Redis.RedisCommandException
13211323
StackExchange.Redis.RedisCommandException.RedisCommandException(string! message) -> void

src/StackExchange.Redis/RawResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ internal RedisChannel AsRedisChannel(byte[]? channelPrefix, RedisChannel.RedisCh
174174
if (StartsWith(channelPrefix))
175175
{
176176
byte[] copy = Payload.Slice(channelPrefix.Length).ToArray();
177+
177178
return new RedisChannel(copy, options);
178179
}
179180
return default;

src/StackExchange.Redis/RedisChannel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace StackExchange.Redis
99
public readonly struct RedisChannel : IEquatable<RedisChannel>
1010
{
1111
internal readonly byte[]? Value;
12+
1213
internal readonly RedisChannelOptions Options;
1314

1415
[Flags]
@@ -36,6 +37,11 @@ internal enum RedisChannelOptions
3637
/// </summary>
3738
public bool IsSharded => (Options & RedisChannelOptions.Sharded) != 0;
3839

40+
/// <summary>
41+
/// Indicates whether this channel represents a shard channel (see <c>SSUBSCRIBE</c>)
42+
/// </summary>
43+
public bool IsSharded => _isSharded;
44+
3945
internal bool IsNull => Value == null;
4046

4147
/// <summary>
@@ -313,4 +319,4 @@ public static implicit operator RedisChannel(byte[]? key)
313319
private RedisChannel(byte[]? value) => throw new NotSupportedException();
314320
#endif
315321
}
316-
}
322+
}

0 commit comments

Comments
 (0)