NCode.Coordination.Resp 0.19.0

Prefix Reserved
dotnet add package NCode.Coordination.Resp --version 0.19.0
                    
NuGet\Install-Package NCode.Coordination.Resp -Version 0.19.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NCode.Coordination.Resp" Version="0.19.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NCode.Coordination.Resp" Version="0.19.0" />
                    
Directory.Packages.props
<PackageReference Include="NCode.Coordination.Resp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NCode.Coordination.Resp --version 0.19.0
                    
#r "nuget: NCode.Coordination.Resp, 0.19.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NCode.Coordination.Resp@0.19.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NCode.Coordination.Resp&version=0.19.0
                    
Install as a Cake Addin
#tool nuget:?package=NCode.Coordination.Resp&version=0.19.0
                    
Install as a Cake Tool

NCode.Coordination.Resp

CI Target framework License

The RESP provider of NCode.Coordination: coordination over Valkey or Garnet, through StackExchange.Redis.

Adding it

services.AddCoordination(coordination => coordination
    .AddRespProvider(resp => resp.Configuration = "valkey.internal:6379,ssl=true,password=...")
    .Bind(new ProviderBinding(RespCoordinationBuilderExtensions.ProviderName)));

Set Configuration, a StackExchange.Redis configuration string, and the provider opens and owns its connection; or set Connection to a factory that returns the host's own IConnectionMultiplexer, which the provider uses and never disposes.

The connection uses TLS, ssl=true in the configuration, unless every endpoint it names is localhost, an address in 127.0.0.0/8, ::1 or a Unix-domain socket. Otherwise the host's start fails as unsupported, and a connection the provider opens is refused before it connects; a host's own connection is checked the same way, from its Configuration. Set AllowUnencryptedConnections, false by default, to connect without TLS to any endpoint, such as inside a network the host trusts. See ADR-1054.

A shared connection keeps its own settings. The provider runs on its default database, reads RESP2 and RESP3 alike, and works with any backlog policy, reporting a call that times out as possibly applied. Its command map must keep EVAL and EVALSHA, or the host's start fails.

CheckInterval, 5 seconds by default, sets how often each notification subscription and watch checks its channel's number, which notices a lost message and, for a watch, deletes and announces the keyspace's expired state. It is at least a millisecond and less than an hour.

Profiles

Profile names the server, RespProfiles.Valkey by default. When the host starts, the provider checks that the server is that vendor, at that profile's version or later, runs Lua scripts and lets its user run them and every command the provider sends, and fails the start otherwise.

  • Valkey 7.2 or later.
  • Garnet 2.2.13 or later, started with --lua --lua-transaction-mode: without them Garnet runs no scripts, or runs them without locking their keys, and nothing at startup can tell the second case.

Primitives

The provider keeps records, record watches, transactions, occurrences, sets, counters, sequences, sessions, membership, leases, semaphores, elections, claims and notifications. Each operation is one server command or one Lua script, and every time to live is measured on the server's clock, in whole milliseconds rounded up.

  • Records: a keyspace keeps its records in one hash, beside an index that lists them under a prefix and the deadlines of those with a time to live. Every change is one script that takes the keyspace's next revision and publishes it, with the keys it wrote or deleted, on the keyspace's watch channel. A record whose time to live has passed is absent at once, and the next script on its keyspace deletes it and announces the delete; a keyspace whose records all have a time to live leaves the server an hour after the last of them ends. A page of a listing examines at most its limit plus 64 entries of the index, so expired records not yet deleted can leave a page short, or empty, with a continuation token; page on until a page has none. A record bound to a session is absent once the session ends, and a script on its keyspace deletes it and announces the delete.
  • Transactions: up to 64 conditions and two branches of up to 64 writes, run as one script on one keyspace's records. A put that binds a record to a session that has ended ends the transaction as session ended, with nothing written.
  • Record watches: a watch on a key or a prefix subscribes to its keyspace's watch channel and starts with a resync at the keyspace's revision. With each event it waits for, it takes the events already queued behind it and reads the records they wrote in one script call of up to 64 records, delivering each record when it holds that write's revision; a record it reads at a later revision is kept and delivered at that revision's event. A delete arrives at its own revision. The provider keeps no history, so a watch that names a revision to resume after starts with a resync too.
  • Occurrences: SET with NX and a time to live. A call the server doesn't answer throws, so a replay guard refuses rather than accepts.
  • Sets: one sorted set per key, each member scored with its own deadline; at most 10,000 live members.
  • Counters: the increment that creates a counter sets its time to live, and a batch of up to 16 increments runs as one script that stops after the first over its limit. A count is at most 9,007,199,254,740,991 (2^53 − 1), the largest integer a Lua number holds exactly; an increment past it fails as limit-exceeded.
  • Sequences: INCR and INCRBY on a key with no time to live, so a sequence never resets while the server keeps its data.
  • Sessions: a session stores its time to live, so every keep-alive renews it in full. A close or the session's expiry ends it at once with the memberships, leases, semaphore slots, leaderships and records bound to it, which are absent from then on; each script on the keyspace removes up to 64 of them. A session's id is 128 random bits.
  • Membership: a group is read at the keyspace's revision, which a join takes, and a leave or a session's end takes when it removes a member or a record, and each member's address and metadata come back as written. A join, a leave and a session's end name the group in the keyspace's event, and a group's watch lists the group again only when an event names it or its channel resyncs.
  • Leases, semaphores and elections: each grant carries a fencing token from a counter per resource that never expires and an owner token of 128 random bits, and is bound to a session or to a time to live. A semaphore has up to 1,024 slots, and a leader's value up to 65,536 bytes.
  • Claims: SET with NX and the time to live the caller gives, on the claim's name followed by its window's segment, so the skew allowance is the caller's, from TimeWindow.TryCreateTimeToLive.
  • Waits: waiting for a session's end or a release, and watching a role, read the server every 100 milliseconds until the condition holds or the caller cancels.
  • Notifications: a publish is one script that takes the topic's next sequence, which never expires, and publishes it with the payload, up to 4,096 bytes, on the topic's channel. A subscription starts with a resync carrying 0, delivers consecutive sequences, and resyncs carrying the last sequence it delivered.
  • Resyncs: every subscription and watch reads its channel's messages in order, and resyncs after a gap, a number that goes backwards, a dropped and restored connection, or a check, every CheckInterval, that finds its channel ahead for more than a second. A watch's check reads the keyspace's revision, which deletes and announces its expired records and ends its expired sessions, so an expiry reaches the watch within the interval.

The provider declares every primitive but notifications linearizable until the server fails over, and every primitive but record watches and notifications volatile, since it can't tell whether the server persists or replicates its writes. Transactions and counter batches are atomic across partitions, because a keyspace lives in one slot. Record watches and notifications are at most once with gap detection: a message can be lost, but never without a resync after it.

Keyspaces

Every key carries its keyspace as its cluster hash tag, so a keyspace and everything in it live in one slot. A cluster spreads keyspaces across its shards, not one keyspace: a keyspace per tenant is the usual unit.

Logging

The provider logs through the ILogger its host's ILoggerFactory makes, with a category per class, and uses no logger when the host registers no ILoggerFactory. It registers no logging provider: the host decides where its logs go. It logs each failure its background work catches and goes on from, once per failed round, with an event id of its band, 3000 to 3999:

Id Name Level Meaning
3001 ChannelNumberReadFailed Warning A subscription could not read its channel's number; it stays in doubt and resyncs at a later check
3002 WatchRecordReadFailed Warning A record watch could not read a written record; it resyncs at a later check
3003 WatchGroupReadFailed Warning A membership watch could not read its group; it resyncs at a later check
3004 UnsubscribeFailed Debug Unsubscribing from a channel failed as a subscription ended; the subscription ends with the connection

Each entry carries the failure as its exception. No entry carries a keyspace, key, channel or topic, since they can name a tenant, so an entry shows that something failed, not for whom. See ADR-1035.

Verification

The provider passes every suite of the conformance kit against Valkey and Garnet, and against a Valkey cluster and a Garnet cluster of three nodes each: concurrent runs of every primitive checked for linearizability and declared delivery, and runs that drop its connections mid-run. Its own tests restart the server mid-run: every failure is unavailable, a call that fails as not applied never applies, and every subscription and watch resyncs and goes on delivering. They also promote a replica while its primary still takes writes, on Valkey and on a Garnet cluster: the writes the old primary acknowledged after the promotion are lost, as linearizable until a failover allows, and every subscription and watch resyncs when the failover takes its numbers back. On a cluster, every key of a keyspace lies in the keyspace's slot; on Valkey its sharded channel is subscribed on that slot's node, and on Garnet a message published on any node reaches its plain channel's subscriber.

Without Sentinel or a cluster to announce a failover, StackExchange.Redis learns of a Valkey replica's promotion only at its next check of each server's role, every configCheckSeconds, 60 seconds by default; until then a write fails as unavailable. Lower it in the configuration string to shorten that outage.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.19.0 0 11/30/2026
0.18.0 43 11/30/2026
0.17.0 51 11/30/2026
0.16.4 41 11/29/2026
0.16.3 53 11/29/2026
0.16.2 51 11/29/2026
0.16.1 45 11/29/2026
0.16.0 52 11/29/2026
0.15.0 50 11/29/2026
0.14.2 57 11/28/2026
0.14.1 56 11/28/2026
0.14.0 53 11/28/2026
0.13.0 62 11/27/2026
0.12.0 60 11/27/2026
0.11.0 59 11/26/2026
0.10.0 63 11/26/2026
0.9.0 62 11/26/2026