HostLoom.Locking.Pipelines
0.4.0
See the version list below for details.
dotnet add package HostLoom.Locking.Pipelines --version 0.4.0
NuGet\Install-Package HostLoom.Locking.Pipelines -Version 0.4.0
<PackageReference Include="HostLoom.Locking.Pipelines" Version="0.4.0" />
<PackageVersion Include="HostLoom.Locking.Pipelines" Version="0.4.0" />
<PackageReference Include="HostLoom.Locking.Pipelines" />
paket add HostLoom.Locking.Pipelines --version 0.4.0
#r "nuget: HostLoom.Locking.Pipelines, 0.4.0"
#:package HostLoom.Locking.Pipelines@0.4.0
#addin nuget:?package=HostLoom.Locking.Pipelines&version=0.4.0
#tool nuget:?package=HostLoom.Locking.Pipelines&version=0.4.0
HostLoom.Locking.Pipelines
A distributed-lock filter for HostLoom.Pipelines, built on the HostLoom.Locking kernel. The
package references those two and nothing else; HostLoom.Pipelines stays dependency-free.
var pipeline = Pipe.Create<RefreshContext>(pipe =>
{
pipe.UseDistributedLock(
distributedLock,
context => $"refresh:{context.Region}",
new LockOptions { Lease = TimeSpan.FromSeconds(30), OnLost = LostLeaseBehavior.Cancel });
pipe.UseExecute(context => RefreshAsync(context));
});
UseDistributedLock runs the rest of the pipe inside IDistributedLock.ExecuteWithLockAsync,
so two contexts with the same key never run downstream at once, across every instance sharing
the lock's provider. Different keys run concurrently. LockNotAcquiredException and
LockProviderUnavailableException propagate unchanged; a retry filter ahead of this one is the
place to decide whether to try again.
Before the rest of the pipe runs, a HeldLock payload is put on the context with the key and the
cancellation token the lock handed to the run. The context's own token cannot be replaced, so a
downstream filter that must stop when the lease is lost watches HeldLock.CancellationToken,
which the lock cancels when the options ask for LostLeaseBehavior.Cancel.
The lock is coordination, not correctness, for persisted state: database transactions, row locks, unique constraints, and idempotency records own correctness.
From the container
The filter has a public constructor taking IDistributedLock and
DistributedLockFilterOptions<TContext>, so HostLoom.Pipelines.DependencyInjection resolves it
per run:
services.AddSingleton(new DistributedLockFilterOptions<RefreshContext>
{
KeySelector = context => $"refresh:{context.Region}",
Lock = new LockOptions { Lease = TimeSpan.FromSeconds(30) },
});
services.AddPipeline<RefreshContext>("refresh", pipeline =>
pipeline.Stage("run", stage =>
stage.AddFilter<DistributedLockFilter<RefreshContext>>().AddFilter<RefreshFilter>()));
The filter describes itself to PipelineProbe.Inspect as a distributedLock scope with the
lease, wait bound, retry policy, and lost-lease behaviour.
| Product | Versions 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. |
-
net10.0
- HostLoom.Locking (>= 0.4.0)
- HostLoom.Pipelines (>= 0.4.0)
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.17.0 | 0 | 10/25/2026 |
| 0.16.1 | 40 | 10/22/2026 |
| 0.16.0 | 91 | 10/14/2026 |
| 0.15.1 | 85 | 10/12/2026 |
| 0.15.0 | 97 | 10/4/2026 |
| 0.14.0 | 95 | 10/4/2026 |
| 0.13.0 | 95 | 9/28/2026 |
| 0.12.0 | 95 | 9/27/2026 |
| 0.11.0 | 98 | 9/25/2026 |
| 0.10.0 | 99 | 9/22/2026 |
| 0.9.0 | 100 | 9/22/2026 |
| 0.8.0 | 102 | 9/19/2026 |
| 0.7.0 | 102 | 9/17/2026 |
| 0.6.0 | 114 | 9/6/2026 |
| 0.5.0 | 120 | 9/5/2026 |
| 0.4.0 | 109 | 9/3/2026 |