Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
7eb4775
Bridge & Connection stats: cleanup
NickCraver Oct 26, 2021
b3038df
Bump SDK versions
NickCraver Oct 26, 2021
50def47
Dammit
NickCraver Oct 26, 2021
69d907c
Let's try this...
NickCraver Oct 26, 2021
133c4bd
C# 10 is too hard.
NickCraver Oct 26, 2021
4f4be8b
Fully revert to non-branch
NickCraver Oct 26, 2021
265c028
Backlog; v3 implementation start
NickCraver Oct 26, 2021
f692312
Woops, good catch!
NickCraver Oct 27, 2021
a207d8b
Merge branch 'craver/stats-cleanup' into craver/backlog-v3
NickCraver Oct 27, 2021
4b5a410
Fix reader/writer states on catastrophic stat failure.
NickCraver Oct 27, 2021
0084522
Merge branch 'craver/stats-cleanup' into craver/backlog-v3
NickCraver Oct 27, 2021
75545f0
Fix tests (token disposal oops) and tweak for speed
NickCraver Oct 27, 2021
6c8edf6
Revert ServerEndPoint (bad commit split)
NickCraver Oct 27, 2021
c86c7d2
Merge remote-tracking branch 'origin/main' into craver/backlog-v3
NickCraver Nov 2, 2021
076bc00
Backlog add hook points past .IsConnected and initial tests
NickCraver Nov 2, 2021
3353ce2
Merge branch 'main' into craver/backlog-v3
NickCraver Nov 12, 2021
9f86830
Remove server-specific for now
NickCraver Nov 12, 2021
f7b0975
Cleanup
NickCraver Nov 12, 2021
eb9c0c3
Update ServerEndPoint.cs
NickCraver Nov 16, 2021
7e17689
ServerEndPoint: clear flags much faster
NickCraver Nov 16, 2021
dc32e0d
Tweak so sync messages get ejected from the queue
NickCraver Nov 16, 2021
6f26239
Add prerelease label
NickCraver Nov 16, 2021
2d15806
Typo fix
NickCraver Dec 12, 2021
bed33f8
ProcessBacklogs comment
NickCraver Dec 12, 2021
1a343c6
Name/comment fixes
NickCraver Dec 12, 2021
b7c3dff
Fix TieBreaker queue - this was going into a never-started backlog
NickCraver Dec 13, 2021
dc3f9b3
Yeah....that'd be bad
NickCraver Dec 13, 2021
fc8a100
Tiebreakers: move into the handshake
NickCraver Dec 14, 2021
77005e7
Merge branch 'craver/handshake-tiebreaker' into craver/backlog-v2.5
NickCraver Dec 14, 2021
7b98bc2
Remove handshake changes
NickCraver Dec 14, 2021
5931685
Rename isHandshake to bypassBacklog
NickCraver Dec 14, 2021
e830cb0
Add release notes
NickCraver Dec 14, 2021
ed60b39
Merge branch 'main' into craver/handshake-tiebreaker
NickCraver Dec 14, 2021
a79c89d
PR fixes!
NickCraver Dec 15, 2021
fa5200c
Tiebreaker: add tests
NickCraver Dec 28, 2021
fb6a135
Add incorrect tiebreaker type test
NickCraver Dec 28, 2021
3bd116b
Merge branch 'craver/handshake-tiebreaker' into craver/backlog-v2.5
NickCraver Dec 28, 2021
0ca6c47
Merge branch 'main' into craver/handshake-tiebreaker
NickCraver Jan 2, 2022
ff59515
Merge branch 'main' into craver/backlog-v2.5
NickCraver Jan 4, 2022
7fccba9
Fix ServerTakesPrecendenceOverSnapshot behavior
NickCraver Jan 4, 2022
0ed0c4c
Merge branch 'craver/handshake-tiebreaker' into craver/backlog-v2.5
NickCraver Jan 4, 2022
410bf80
Pull in the Area Fix
NickCraver Jan 4, 2022
b364d47
Fix naming and remove unused asyncState
NickCraver Jan 4, 2022
b280c87
Issue922_ReconnectRaised: Add logging
NickCraver Jan 4, 2022
7b42366
Backlog: handle timeouts better
NickCraver Jan 4, 2022
784d78a
Revert subscribe -> internal
NickCraver Jan 4, 2022
582e5f1
Issue922: Fix assumptions
NickCraver Jan 4, 2022
b8d2636
Increase PubSubGetAllCorrectOrder_OnMessage_Async gap
NickCraver Jan 4, 2022
91339f1
PubSub tests: make it more specific and resilient
NickCraver Jan 4, 2022
3018442
Add more data to this bugger...
NickCraver Jan 4, 2022
ade853b
Subscriber: simplify
NickCraver Jan 5, 2022
1f946d4
add new client flags
mgravell Jan 6, 2022
272f1a3
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 6, 2022
a4425ec
Changes for #1912
NickCraver Jan 10, 2022
b0fb2a1
Revert 1 mismatch
NickCraver Jan 10, 2022
b567956
Merge branch 'craver/backlog-prep' into craver/backlog-v2.5
NickCraver Jan 10, 2022
65d6268
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 10, 2022
990f5e8
WIP: Pub/Sub portion of #1912
NickCraver Jan 10, 2022
38132a3
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 10, 2022
d552097
Lots of things - need to writeup in PR
NickCraver Jan 10, 2022
fac5a1b
Fix KeepAlive on PhysicalBridge
NickCraver Jan 10, 2022
1cb00ff
Fix default version tests
NickCraver Jan 10, 2022
a2d0943
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 11, 2022
7fdb45a
Fix up Isue922 test now that we ping the right things
NickCraver Jan 11, 2022
85c5a4d
Migrate PubSub tests off sync threads
NickCraver Jan 11, 2022
98701c9
Fix shared connections with simulated failures (cross-test noise)
NickCraver Jan 11, 2022
377c813
Compensate for delay removal
NickCraver Jan 11, 2022
d9c68e1
Add logging to pubsub methods
NickCraver Jan 11, 2022
3f6e030
Add logging to PubSubGetAllCorrectOrder
NickCraver Jan 11, 2022
b63648a
Tidy exception messages
NickCraver Jan 11, 2022
25a7058
Fix stupid
NickCraver Jan 12, 2022
a38fac2
Remove unneeded retry change
NickCraver Jan 12, 2022
148c975
Eliminate writer here
NickCraver Jan 12, 2022
bf9fa07
Writer: switch back to SemaphoreSlim
NickCraver Jan 15, 2022
e4e6d73
Ignore message ordering on the hot paths
NickCraver Jan 16, 2022
62c6b7d
Change up Issue 922 for better reporting and accuracy
NickCraver Jan 16, 2022
5141cc8
Merge + code cleanup
NickCraver Jan 17, 2022
532c01f
Move to Task.Run() for .NET 6, cleanup, and backlog queue contention …
NickCraver Jan 17, 2022
78ebf5e
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 18, 2022
78efb6b
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 18, 2022
d496348
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 18, 2022
bc11b96
Fix merge
NickCraver Jan 18, 2022
47f0a12
Format options
NickCraver Jan 18, 2022
60b3c42
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 18, 2022
8e168d9
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 18, 2022
412f9e8
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Jan 19, 2022
21d36f0
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 19, 2022
49a917d
Sync tests
NickCraver Jan 19, 2022
8f5bf58
Debug: lots of pruning
NickCraver Jan 19, 2022
3d20350
Merge remote-tracking branch 'origin/craver/backlog-v2.5' into craver…
NickCraver Jan 20, 2022
c958320
Fix revert
NickCraver Jan 20, 2022
185c62c
Merge remote-tracking branch 'origin/craver/debug-cleanup' into crave…
NickCraver Jan 20, 2022
2b57b0b
Fix merge
NickCraver Jan 20, 2022
144c22e
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 20, 2022
92cecfc
WIP: This could all be a bad idea
NickCraver Jan 20, 2022
7d7f020
Gap commit
NickCraver Jan 20, 2022
f247980
Pub/Sub: default to 3.0, fix PING, fix server selection in cluster, a…
NickCraver Jan 20, 2022
6ecde2a
Include PING routing
NickCraver Jan 20, 2022
f91e4c5
Revert testing change
NickCraver Jan 20, 2022
bca9de0
Merge remote-tracking branch 'origin/main' into craver/pub-sub-prep
NickCraver Jan 20, 2022
5a6db1c
Merge branch 'craver/pub-sub-prep' into craver/pub-sub-issues
NickCraver Jan 20, 2022
daa1b9c
Revert that bandaid test
NickCraver Jan 20, 2022
f36b6d9
Merge remote-tracking branch 'origin/craver/pub-sub-prep' into craver…
NickCraver Jan 20, 2022
70e1735
Nope.
NickCraver Jan 20, 2022
a814231
Bits
NickCraver Jan 20, 2022
1d4b4ad
Sync work stop commit (moving to laptop!)
NickCraver Jan 21, 2022
5de45a2
Tests: profiler logging made easier
NickCraver Jan 22, 2022
64565dd
Tests: use profiling and add more logging
NickCraver Jan 22, 2022
00f851c
Pub/Sub: Register immediately, but complete async
NickCraver Jan 22, 2022
029c2a3
Pre-clear rather than await
NickCraver Jan 22, 2022
341f532
Fix more things
NickCraver Jan 22, 2022
48127a1
Merge branch 'craver/pub-sub-wip' into craver/pub-sub-issues
NickCraver Jan 22, 2022
5dbf575
Add logging to TestPublishWithSubscribers
NickCraver Jan 22, 2022
237848f
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 22, 2022
95b39b8
Merge branch 'craver/pub-sub-issues' into craver/backlog-v2.5
NickCraver Jan 22, 2022
ab41493
Meeeeeeerge fun
NickCraver Jan 22, 2022
51c927b
Light up more pubsub tests
NickCraver Jan 23, 2022
20d2d28
Several subtle but big changes
NickCraver Jan 23, 2022
814b401
More PubSub logging
NickCraver Jan 23, 2022
667aa34
TestPatternPubSub: give reception a moment
NickCraver Jan 23, 2022
cf96bba
Moar!
NickCraver Jan 23, 2022
a6be64a
Add logging to Issue1101 pipe
NickCraver Jan 23, 2022
42a9267
Merge branch 'craver/pub-sub-issues' into craver/backlog-v2.5
NickCraver Jan 23, 2022
31b38dc
PubSubGetAllAnyOrder: don't share conn
NickCraver Jan 23, 2022
79e5090
TextWriterOutputHelper: fix end-of-tests race case
NickCraver Jan 23, 2022
aef7832
Merge branch 'craver/pub-sub-issues' into craver/backlog-v2.5
NickCraver Jan 23, 2022
8ea3b6d
Bump Docker images to 6.2.6
NickCraver Jan 23, 2022
d9caedb
Nick, you idiot.
NickCraver Jan 23, 2022
3fa77a4
Fix log message too
NickCraver Jan 23, 2022
04233fe
Sentinel: Fire and Forget on startup
NickCraver Jan 23, 2022
ff54012
ExplicitPublishMode: remove delay
NickCraver Jan 23, 2022
dc26751
Merge branch 'craver/pub-sub-issues' into craver/backlog-v2.5
NickCraver Jan 23, 2022
84439d4
Cleanup and comments!
NickCraver Jan 23, 2022
60d9b80
More comments!
NickCraver Jan 23, 2022
c6fb569
Annnnnd the other Sentinel one
NickCraver Jan 23, 2022
c0206fa
Start PubSubMultiserver
NickCraver Jan 24, 2022
b484e5f
Tests, yay!
NickCraver Jan 24, 2022
837a654
Assert up front
NickCraver Jan 24, 2022
b0001ab
PubSub tests: log everything
NickCraver Jan 24, 2022
1bc971d
Primary/Replica tests
NickCraver Jan 25, 2022
907cd20
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 25, 2022
9c31958
Fix PubSub tests: can't share that connection yo
NickCraver Jan 25, 2022
eed3ba0
Remove the .NET 5.0 from Windows build too...
NickCraver Jan 25, 2022
cd29add
Merge branch 'craver/pub-sub-issues' into craver/backlog-v2.5
NickCraver Jan 25, 2022
2fe8d13
Sentinel: account for multi-suite failover states
NickCraver Jan 25, 2022
6f9ae70
Merge branch 'craver/pub-sub-issues' into craver/backlog-v2.5
NickCraver Jan 25, 2022
d234235
ExecuteWithUnsubscribeViaSubscriber: don't share conn
NickCraver Jan 25, 2022
33f52af
Re-disable TestMassivePublishWithWithoutFlush_Local
NickCraver Jan 25, 2022
6140700
Merge remote-tracking branch 'origin/main' into craver/pub-sub-issues
NickCraver Jan 25, 2022
5d0ee35
Merge remote-tracking branch 'origin/craver/pub-sub-issues' into crav…
NickCraver Jan 26, 2022
f88e8e1
PR feedback!
NickCraver Jan 26, 2022
2185911
Adjust RedisServer.ExecuteSync/Async<T> for "don't care" cases
NickCraver Jan 26, 2022
3f694c5
Nick you dummy
NickCraver Jan 26, 2022
2edf892
PubSubMultiserver: separate channels on publishers
NickCraver Jan 26, 2022
678e379
MakePrimaryAsync/ReplicaOfAsync
NickCraver Jan 28, 2022
6825f29
Docs and cleanup!
NickCraver Jan 30, 2022
221509a
Merge remote-tracking branch 'origin/main' into craver/backlog-v2.5
NickCraver Feb 4, 2022
b77d0a3
CI Tweaks (#1970)
NickCraver Feb 4, 2022
04ce70b
Seal backlog
NickCraver Feb 4, 2022
565838b
Merge remote-tracking branch 'origin/craver/backlog-v2.5' into craver…
NickCraver Feb 4, 2022
85bfbbc
Merge branch 'craver/backlog-v2.5' into craver/docs-work
NickCraver Feb 4, 2022
98b145b
Docs, so many docs, and a few very small tweaks (can separate later)
NickCraver Feb 4, 2022
4f5f538
Merge branch 'main' into craver/docs-work
NickCraver Feb 6, 2022
9661ec4
Merge branch 'main' into craver/primary-async
NickCraver Feb 6, 2022
58bfaf0
Merge branch 'craver/primary-async' into craver/docs-work
NickCraver Feb 6, 2022
6d86336
More on CommandMap
NickCraver Feb 6, 2022
3c3136f
#pragma cleanup
NickCraver Feb 6, 2022
77680e4
Fix links and twemproxy capitalization
NickCraver Feb 6, 2022
dd1ba46
ConnectionMultiplexer love
NickCraver Feb 6, 2022
329eb65
Fix method ref
NickCraver Feb 6, 2022
2888fe7
Update ConfigurationOptions.cs
NickCraver Feb 6, 2022
e67ae40
Fix batch 1
NickCraver Feb 6, 2022
1504c33
Last batch, maybe, who knows.
NickCraver Feb 6, 2022
d3afa2f
Merge remote-tracking branch 'origin/main' into craver/primary-async
NickCraver Feb 7, 2022
af65aa9
Merge branch 'craver/primary-async' into craver/docs-work
NickCraver Feb 7, 2022
7ac045f
Update timeout docs
NickCraver Feb 7, 2022
d7b5265
Merge remote-tracking branch 'origin/main' into craver/docs-work
NickCraver Feb 8, 2022
0865f00
Update for PR!
NickCraver Feb 8, 2022
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@ csharp_space_after_keywords_in_control_flow_statements = true:suggestion
# Language settings
csharp_prefer_simple_default_expression = false:none

# RCS1194: Implement exception constructors.
dotnet_diagnostic.RCS1194.severity = none

# RCS1229: Use async/await when necessary.
dotnet_diagnostic.RCS1229.severity = none
4 changes: 2 additions & 2 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ The above is equivalent to (in the connection string):
$INFO=,$SELECT=use
```

Twemproxy
twemproxy
---

[Twemproxy](https://github.com/twitter/twemproxy) is a tool that allows multiple redis instances to be used as though it were a single server, with inbuilt sharding and fault tolerance (much like redis cluster, but implemented separately). The feature-set available to Twemproxy is reduced. To avoid having to configure this manually, the `Proxy` option can be used:
[twemproxy](https://github.com/twitter/twemproxy) is a tool that allows multiple redis instances to be used as though it were a single server, with inbuilt sharding and fault tolerance (much like redis cluster, but implemented separately). The feature-set available to Twemproxy is reduced. To avoid having to configure this manually, the `Proxy` option can be used:

```csharp
var options = new ConfigurationOptions
Expand Down
10 changes: 6 additions & 4 deletions docs/Timeouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ How to configure this setting:

> **Important Note:** the value specified in this configuration element is a *per-core* setting. For example, if you have a 4 core machine and want your minIOThreads setting to be 200 at runtime, you would use `<processModel minIoThreads="50"/>`.

- Outside of ASP.NET, use the [ThreadPool.SetMinThreads(…)](https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadpool.setminthreads?view=netcore-2.0#System_Threading_ThreadPool_SetMinThreads_System_Int32_System_Int32_) API.

- In .Net Core, add Environment Variable COMPlus_ThreadPool_ForceMinWorkerThreads to overwrite default MinThreads setting, according to [Environment/Registry Configuration Knobs](https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/clr-configuration-knobs.md) - You can also use the same ThreadPool.SetMinThreads() Method as described above.
- Outside of ASP.NET, use one of the methods described in [Run-time configuration options for threading
](https://docs.microsoft.com/dotnet/core/run-time-config/threading#minimum-threads):
- [ThreadPool.SetMinThreads(…)](https://docs.microsoft.com/dotnet/api/system.threading.threadpool.setminthreads)
- The `ThreadPoolMinThreads` MSBuild property
- The `System.Threading.ThreadPool.MinThreads` setting in your `runtimeconfig.json`

Explanation for abbreviations appearing in exception messages
---
By default Redis Timeout exception(s) includes useful information, which can help in uderstanding & diagnosing the timeouts. Some of the abbrivations are as follows:
By default Redis Timeout exception(s) includes useful information, which can help in understanding & diagnosing the timeouts. Some of the abbreviations are as follows:

| Abbreviation | Long Name | Meaning |
| ------------- | ---------------------- | ---------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion src/StackExchange.Redis/AssemblyInfoHack.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Yes, this is embarassing. However, in .NET Core the including AssemblyInfo (ifdef'd or not) will screw with
// Yes, this is embarrassing. However, in .NET Core the including AssemblyInfo (ifdef'd or not) will screw with
// your version numbers. Therefore, we need to move the attribute out into another file...this file.
// When .csproj merges in, this should be able to return to Properties/AssemblyInfo.cs
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/StackExchange.Redis/BacklogPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public sealed class BacklogPolicy
/// <summary>
/// Whether to queue commands while disconnected.
/// True means queue for attempts up until their timeout.
/// False means to fail ASAP and queue nothing.
/// <see langword="false"/> means to fail ASAP and queue nothing.
/// </summary>
public bool QueueWhileDisconnected { get; init; }

Expand Down
2 changes: 2 additions & 0 deletions src/StackExchange.Redis/BufferReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal enum ConsumeResult
Success,
NeedMoreData,
}

internal ref struct BufferReader
{
private long _totalConsumed;
Expand Down Expand Up @@ -209,6 +210,7 @@ public int ConsumeByte()
Consume(1);
return value;
}

public int PeekByte() => IsEmpty ? -1 : _current[OffsetThisSpan];

public ReadOnlySequence<byte> SliceFromCurrent()
Expand Down
39 changes: 19 additions & 20 deletions src/StackExchange.Redis/ChannelMessageQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@
namespace StackExchange.Redis
{
/// <summary>
/// Represents a message that is broadcast via pub/sub
/// Represents a message that is broadcast via publish/subscribe.
/// </summary>
public readonly struct ChannelMessage
{
private readonly ChannelMessageQueue _queue; // this is *smaller* than storing a RedisChannel for the subscribed channel
// this is *smaller* than storing a RedisChannel for the subscribed channel
private readonly ChannelMessageQueue _queue;

/// <summary>
/// See Object.ToString
/// The Channel:Message string representation.
/// </summary>
public override string ToString() => ((string)Channel) + ":" + ((string)Message);

/// <summary>
/// See Object.GetHashCode
/// </summary>
/// <inheritdoc/>
public override int GetHashCode() => Channel.GetHashCode() ^ Message.GetHashCode();

/// <summary>
/// See Object.Equals
/// </summary>
/// <param name="obj">The <see cref="object"/> to compare.</param>
/// <inheritdoc/>
public override bool Equals(object obj) => obj is ChannelMessage cm
&& cm.Channel == Channel && cm.Message == Message;
internal ChannelMessage(ChannelMessageQueue queue, in RedisChannel channel, in RedisValue value)
Expand All @@ -36,16 +33,17 @@ internal ChannelMessage(ChannelMessageQueue queue, in RedisChannel channel, in R
}

/// <summary>
/// The channel that the subscription was created from
/// The channel that the subscription was created from.
/// </summary>
public RedisChannel SubscriptionChannel => _queue.Channel;

/// <summary>
/// The channel that the message was broadcast to
/// The channel that the message was broadcast to.
/// </summary>
public RedisChannel Channel { get; }

/// <summary>
/// The value that was broadcast
/// The value that was broadcast.
/// </summary>
public RedisValue Message { get; }

Expand All @@ -61,25 +59,28 @@ internal ChannelMessage(ChannelMessageQueue queue, in RedisChannel channel, in R
}

/// <summary>
/// Represents a message queue of ordered pub/sub notifications
/// Represents a message queue of ordered pub/sub notifications.
/// </summary>
/// <remarks>To create a ChannelMessageQueue, use ISubscriber.Subscribe[Async](RedisKey)</remarks>
/// <remarks>
/// To create a ChannelMessageQueue, use <see cref="ISubscriber.Subscribe(RedisChannel, CommandFlags)"/>
/// or <see cref="ISubscriber.SubscribeAsync(RedisChannel, CommandFlags)"/>.
/// </remarks>
public sealed class ChannelMessageQueue
{
private readonly Channel<ChannelMessage> _queue;
/// <summary>
/// The Channel that was subscribed for this queue
/// The Channel that was subscribed for this queue.
/// </summary>
public RedisChannel Channel { get; }
private RedisSubscriber _parent;

/// <summary>
/// See Object.ToString
/// The string representation of this channel.
/// </summary>
public override string ToString() => (string)Channel;

/// <summary>
/// An awaitable task the indicates completion of the queue (including drain of data)
/// An awaitable task the indicates completion of the queue (including drain of data).
/// </summary>
public Task Completion => _queue.Reader.Completion;

Expand All @@ -97,9 +98,7 @@ internal ChannelMessageQueue(in RedisChannel redisChannel, RedisSubscriber paren
AllowSynchronousContinuations = false,
};

#pragma warning disable RCS1231 // Make parameter ref read-only. - uses as a delegate for Action<RedisChannel, RedisValue>
private void Write(in RedisChannel channel, in RedisValue value)
#pragma warning restore RCS1231 // Make parameter ref read-only.
{
var writer = _queue.Writer;
writer.TryWrite(new ChannelMessage(this, channel, value));
Expand Down
122 changes: 88 additions & 34 deletions src/StackExchange.Redis/ClientInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,106 +5,160 @@
namespace StackExchange.Redis
{
/// <summary>
/// Represents the state of an individual client connection to redis
/// Represents the state of an individual client connection to redis.
/// </summary>
public sealed class ClientInfo
{
internal static readonly ResultProcessor<ClientInfo[]> Processor = new ClientInfoProcessor();

/// <summary>
/// Address (host and port) of the client
/// Address (host and port) of the client.
/// </summary>
public EndPoint Address { get; private set; }

/// <summary>
/// total duration of the connection in seconds
/// Total duration of the connection in seconds.
/// </summary>
public int AgeSeconds { get; private set; }

/// <summary>
/// current database ID
/// Current database ID.
/// </summary>
public int Database { get; private set; }

/// <summary>
/// The flags associated with this connection
/// The flags associated with this connection.
/// </summary>
public ClientFlags Flags { get; private set; }

/// <summary>
/// The client flags can be a combination of:
///
/// A: connection to be closed ASAP
/// b: the client is waiting in a blocking operation
/// c: connection to be closed after writing entire reply
/// d: a watched keys has been modified - EXEC will fail
/// i: the client is waiting for a VM I/O (deprecated)
/// M: the client is a master
/// N: no specific flag set
/// O: the client is a replica in MONITOR mode
/// P: the client is a Pub/Sub subscriber
/// r: the client is in readonly mode against a cluster node
/// S: the client is a normal replica server
/// U: the client is connected via a Unix domain socket
/// x: the client is in a MULTI/EXEC context
/// t: the client enabled keys tracking in order to perform client side caching
/// R: the client tracking target client is invalid
/// B: the client enabled broadcast tracking mode
/// <list type="table">
/// <item>
/// <term>A</term>
/// <description>Connection to be closed ASAP.</description>
/// </item>
/// <item>
/// <term>b</term>
/// <description>The client is waiting in a blocking operation.</description>
/// </item>
/// <item>
/// <term>c</term>
/// <description>Connection to be closed after writing entire reply.</description>
/// </item>
/// <item>
/// <term>d</term>
/// <description>A watched keys has been modified - EXEC will fail.</description>
/// </item>
/// <item>
/// <term>i</term>
/// <description>The client is waiting for a VM I/O (deprecated).</description>
/// </item>
/// <item>
/// <term>M</term>
/// <description>The client is a primary.</description>
/// </item>
/// <item>
/// <term>N</term>
/// <description>No specific flag set.</description>
/// </item>
/// <item>
/// <term>O</term>
/// <description>The client is a replica in MONITOR mode.</description>
/// </item>
/// <item>
/// <term>P</term>
/// <description>The client is a Pub/Sub subscriber.</description>
/// </item>
/// <item>
/// <term>r</term>
/// <description>The client is in readonly mode against a cluster node.</description>
/// </item>
/// <item>
/// <term>S</term>
/// <description>The client is a normal replica server.</description>
/// </item>
/// <item>
/// <term>u</term>
/// <description>The client is unblocked.</description>
/// </item>
/// <item>
/// <term>U</term>
/// <description>The client is unblocked.</description>
/// </item>
/// <item>
/// <term>x</term>
/// <description>The client is in a MULTI/EXEC context.</description>
/// </item>
/// <item>
/// <term>t</term>
/// <description>The client enabled keys tracking in order to perform client side caching.</description>
/// </item>
/// <item>
/// <term>R</term>
/// <description>The client tracking target client is invalid.</description>
/// </item>
/// <item>
/// <term>B</term>
/// <description>The client enabled broadcast tracking mode.</description>
/// </item>
/// </list>
/// </summary>
/// <remarks>https://redis.io/commands/client-list</remarks>
public string FlagsRaw { get; private set; }

/// <summary>
/// The host of the client (typically an IP address)
/// The host of the client (typically an IP address).
/// </summary>
public string Host => Format.TryGetHostPort(Address, out string host, out _) ? host : null;

/// <summary>
/// idle time of the connection in seconds
/// Idle time of the connection in seconds.
/// </summary>
public int IdleSeconds { get; private set; }

/// <summary>
/// last command played
/// Last command played.
/// </summary>
public string LastCommand { get; private set; }

/// <summary>
/// The name allocated to this connection, if any
/// The name allocated to this connection, if any.
/// </summary>
public string Name { get; private set; }

/// <summary>
/// number of pattern matching subscriptions
/// Number of pattern matching subscriptions.
/// </summary>
public int PatternSubscriptionCount { get; private set; }

/// <summary>
/// The port of the client
/// The port of the client.
/// </summary>
public int Port => Format.TryGetHostPort(Address, out _, out int port) ? port : 0;

/// <summary>
/// The raw content from redis
/// The raw content from redis.
/// </summary>
public string Raw { get; private set; }

/// <summary>
/// number of channel subscriptions
/// Number of channel subscriptions.
/// </summary>
public int SubscriptionCount { get; private set; }

/// <summary>
/// number of commands in a MULTI/EXEC context
/// Number of commands in a MULTI/EXEC context.
/// </summary>
public int TransactionCommandLength { get; private set; }

/// <summary>
/// an unique 64-bit client ID (introduced in Redis 2.8.12).
/// A unique 64-bit client ID (introduced in Redis 2.8.12).
/// </summary>
public long Id { get;private set; }

/// <summary>
/// Format the object as a string
/// Format the object as a string.
/// </summary>
public override string ToString()
{
Expand All @@ -113,7 +167,7 @@ public override string ToString()
}

/// <summary>
/// The class of the connection
/// The class of the connection.
/// </summary>
public ClientType ClientType
{
Expand Down
Loading