Goldpath.Locking
0.1.0-preview.8
dotnet add package Goldpath.Locking --version 0.1.0-preview.8
NuGet\Install-Package Goldpath.Locking -Version 0.1.0-preview.8
<PackageReference Include="Goldpath.Locking" Version="0.1.0-preview.8" />
<PackageVersion Include="Goldpath.Locking" Version="0.1.0-preview.8" />
<PackageReference Include="Goldpath.Locking" />
paket add Goldpath.Locking --version 0.1.0-preview.8
#r "nuget: Goldpath.Locking, 0.1.0-preview.8"
#:package Goldpath.Locking@0.1.0-preview.8
#addin nuget:?package=Goldpath.Locking&version=0.1.0-preview.8&prerelease
#tool nuget:?package=Goldpath.Locking&version=0.1.0-preview.8&prerelease
Goldpath.Locking
Ring B distributed locking: Medallion DistributedLock composed behind manifest-driven
provider selection — Redis (RedLock), Postgres (advisory locks) or SQL Server
(sp_getapplock) — with tenant-scoped lock names and acquire metrics.
Honest scope: locks reduce duplicate work; they are NOT correctness fences (no fencing tokens — a paused holder can outlive its lock). Correctness comes from the Idempotency module; the two compose.
Getting started
builder.AddGoldpathLocking(); // provider per manifest
public sealed class SettlementJob(IDistributedLockProvider locks, GoldpathLockNames names)
{
public async Task RunAsync(CancellationToken ct)
{
await using var handle = await locks.TryAcquireLockAsync(
names.For("settlement"), TimeSpan.FromSeconds(5), ct);
if (handle is null) return; // another instance holds it — that's the point
// ... exactly one instance runs this ...
}
}
IDistributedLockProvider is Medallion's own interface — no Goldpath wrapper; the full acquire
API (wait, try-with-timeout, sync/async) is the library's, documented not rewritten.
Configuration
"Goldpath": {
"DistributedLocking": {
"Provider": "Redis", // Redis | Postgres | SqlServer
"ConnectionName": "redis" // db providers: point at the app db → ZERO new infra
}
}
Advanced
- Names are tenant-scoped and fail-closed:
names.For("nightly-report")→goldpath:{tenant}:lock:nightly-report; with NO ambient tenant it THROWS (a silent cross-tenant lock collision is a correctness bug). Background flows either pin a tenant withGoldpathTenant.Use(...)or declareGoldpathLockNames.Global("name")— explicit and greppable. - Metrics via a decorator over the same interface (composition, not a wrapper
abstraction):
goldpath_lock_acquire_total{outcome}andgoldpath_lock_wait_secondsflow into Ring A OTel. - Provider swap is behavior-neutral — the same contract test runs against real Redis
AND real Postgres in CI (
LockContractTests). - Timeout semantics:
TryAcquire*returnsnullon contention (no exception);Acquire*waits and throwsTimeoutException— pick by intent.
Providers
Redis (reuses the caching L2 connection by default) · Postgres advisory locks · SQL Server
sp_getapplock. ZooKeeper/etcd deferred until a project demands them (RFC).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- DistributedLock.Postgres (>= 1.3.1)
- DistributedLock.Redis (>= 1.1.1)
- Goldpath.Abstractions (>= 0.1.0-preview.8)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
-
net8.0
- DistributedLock.Postgres (>= 1.3.1)
- DistributedLock.Redis (>= 1.1.1)
- Goldpath.Abstractions (>= 0.1.0-preview.8)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Goldpath.Locking:
| Package | Downloads |
|---|---|
|
Goldpath.Locking.SqlServer
SQL Server provider (sp_getapplock) for Goldpath.Locking. Ships separately ON PURPOSE: its dependency chain carries Microsoft's proprietary-but-free SqlClient SNI runtime (Microsoft Software License Terms — closed source, free of charge). Only teams that explicitly choose SQL Server — and therefore already run commercially-licensed Microsoft data infrastructure — take that dependency; the core Goldpath.Locking graph stays fully open source. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.8 | 89 | 9/7/2026 |
| 0.1.0-preview.7 | 94 | 9/1/2026 |
| 0.1.0-preview.6 | 382 | 8/4/2026 |
| 0.1.0-preview.5 | 96 | 7/28/2026 |
| 0.1.0-preview.4 | 83 | 7/27/2026 |
| 0.1.0-preview.3 | 64 | 7/25/2026 |
| 0.1.0-preview.2 | 72 | 7/13/2026 |
| 0.1.0-preview.1 | 105 | 7/13/2026 |