EricksonLopez.DistributedLock

dotnet-distributedlock · Reliability & Concurrency

On this page (20 sections)

1. Identity, Tier & Maturity Profile#

L2 Cross-Cutting & ReliabilityStableMaintenance: MaintainedAOT: FullMIT LicenseConfidence: HIGH
InfrastructureCross-Cuttingnet8.0net9.0net10.0

2. Value Proposition & Problem Solved#

High-performance distributed locking & mutual exclusion ecosystem for .NET 8/9/10. Zero-exception Result pattern, Native AOT compliant, OpenTelemetry metrics, and native providers for PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, SQLite, and Redis.

Uncoordinated worker replicas execute scheduled jobs or reconciliations simultaneously, and legacy lock tools often mandate extra ZooKeeper or Consul clusters.

3. Quick Install#

Primary package: EricksonLopez.DistributedLock.Abstractions

dotnet add package EricksonLopez.DistributedLock.Abstractions --version 1.0.0
Also published in this family:
EricksonLopez.DistributedLock.PostgreSqlEricksonLopez.DistributedLock.RedisEricksonLopez.DistributedLock.OracleEricksonLopez.DistributedLock.MariaDbEricksonLopez.DistributedLock.SqliteEricksonLopez.DistributedLock.MySql

4. Verified Ecosystem Metrics#

v1.0.0
NuGet Published Version
v2.1.0
Repo HEAD Version
1,146
NuGet Downloads
8
Packable Packages
225
Public API Members
0
Benchmark Rows (RyuJIT)

Snapshot retrieved UTC: 2026-12-01

5. When to Use & When Not to Use#

When to use

  • You want Result-based IDistributedLockProvider mutual exclusion backed by your existing database (PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, SQLite) or Redis.

When NOT to use

  • You need multi-step optimistic version conflict detection on entities—use EricksonLopez.Concurrency.

6. Core Capabilities & Design Invariants#

Decoupled Core Abstractions

Core contract lives in EricksonLopez.DistributedLock.Abstractions with zero concrete driver dependencies.

7 Provider Backends & Keepalive

Supports TryAcquireAsync, jittered polling AcquireAsync, session locks, and transaction-scoped advisory locks.

7. Included NuGet Packages & Adapters#

Package IDStatusNuGet / LocalTFMsAOT StatusDownloadsDescription
EricksonLopez.DistributedLock.AbstractionsPrimaryPublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full244Tier 0 distributed locking contracts, provider abstractions, and Result-based failure models for the EricksonLopez platform.
EricksonLopez.DistributedLock.PostgreSqlPublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full134High-performance PostgreSQL advisory lock provider implementing IDistributedLockProvider for the EricksonLopez platform. Features Native AOT compatibility, zero-allocation error handling, keepalive heartbeats, and OpenTelemetry instrumentation.
EricksonLopez.DistributedLock.RedisPublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full132Redis distributed lock provider implementing IDistributedLockProvider for the EricksonLopez platform using StackExchange.Redis with Lua scripts for atomic release and lease renewals. Features zero-allocation error handling and OpenTelemetry instrumentation. Native AOT compatibility is subject to StackExchange.Redis AOT support for the specific version in use.
EricksonLopez.DistributedLock.OraclePublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full131Oracle Database lock provider implementing IDistributedLockProvider for the EricksonLopez platform using DBMS_LOCK via Oracle.ManagedDataAccess.Core. Features Native AOT compatibility, zero-allocation error handling, and OpenTelemetry instrumentation.
EricksonLopez.DistributedLock.MariaDbPublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full130MariaDB user-level lock provider implementing IDistributedLockProvider for the EricksonLopez platform using GET_LOCK / RELEASE_LOCK via MySqlConnector. Features Native AOT compatibility, zero-allocation error handling, and OpenTelemetry instrumentation.
EricksonLopez.DistributedLock.SqlitePublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full127SQLite lock provider implementing IDistributedLockProvider for the EricksonLopez platform using database-enforced concurrency locks via Microsoft.Data.Sqlite. Features Native AOT compatibility, zero-allocation error handling, and OpenTelemetry instrumentation.
EricksonLopez.DistributedLock.MySqlPublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full126MySQL user-level lock provider implementing IDistributedLockProvider for the EricksonLopez platform using GET_LOCK / RELEASE_LOCK via MySqlConnector. Features Native AOT compatibility, zero-allocation error handling, and OpenTelemetry instrumentation.
EricksonLopez.DistributedLock.SqlServerPublishedv1.0.0 / v2.1.0net8.0, net9.0, net10.0AOT: Full122Microsoft SQL Server application lock provider implementing IDistributedLockProvider for the EricksonLopez platform using sp_getapplock / sp_releaseapplock. Features Native AOT compatibility, zero-allocation error handling, keepalive heartbeats, and OpenTelemetry instrumentation.

8. Quick Start Code Example#

Grounded in verified public APIs from EricksonLopez.DistributedLock. Compile with `<ImplicitUsings>disable</ImplicitUsings>` and explicit imports.

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Npgsql;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddPostgresDistributedLock(
    sp => new NpgsqlConnection(builder.Configuration.GetConnectionString("Database")),
    options =>
    {
        options.KeepaliveCadence = TimeSpan.FromSeconds(30);
        options.InitialPollingInterval = TimeSpan.FromMilliseconds(25);
        options.MaxPollingInterval = TimeSpan.FromMilliseconds(500);
        options.JitterRatio = 0.25;
    });

9. Architecture & Dependency Flow#

flowchart LR
  lib_distributedlock["EricksonLopez.DistributedLock (L2)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_distributedlock --> lib_result
EricksonLopez.DistributedLock Dependency Topology1 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.
View accessible text summary and structure

1 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.

DirectionLibraryTierRelationship Kinds
UpstreamEricksonLopez.ResultL0Compile-Time, NuGet Package
flowchart LR
  lib_distributedlock["EricksonLopez.DistributedLock (L2)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_distributedlock --> lib_result

10. Target Frameworks & Native AOT / Trimming Matrix#

MSBuild `.csproj` inspection across 8 packages: 8 Full, 0 Partial, 0 Incompatible, 0 NotApplicable (analyzers/generators).

Package IDIsAotCompatibleEnableTrimAnalyzerVerified AOT StatusTarget Frameworks
EricksonLopez.DistributedLock.AbstractionstruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.PostgreSqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.RedistruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.OracletruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.MariaDbtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.SqlitetruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.MySqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.DistributedLock.SqlServertruetrueFullnet8.0, net9.0, net10.0

11. Upstream Dependencies & Downstream Dependents#

Upstream Dependencies (1)

Downstream Dependents (0)

No other EricksonLopez.* libraries currently depend on this family.

12. Optional Adapters & Third-Party Integrations#

Internal Adapter Edges & Integration Packages

No optional cross-family adapter edges or integration packages are recorded for this library.

Verified External NuGet Dependencies (8)

Microsoft.Data.SqlClientMicrosoft.Data.SqliteMicrosoft.Extensions.DependencyInjection.AbstractionsMicrosoft.Extensions.Logging.AbstractionsMicrosoft.Extensions.OptionsMySqlConnectorOracle.ManagedDataAccess.CoreStackExchange.Redis

13. Configuration & DI Registration Summary#

Verified DI & Configuration Entry Points

  • MariaDbDistributedLockExtensions.AddMariaDbDistributedLock

    Registers the MariaDB distributed lock provider with a connection factory delegate.

  • MySqlDistributedLockExtensions.AddMySqlDistributedLock

    Registers the MySQL distributed lock provider with a connection factory delegate.

  • OracleDistributedLockExtensions.AddOracleDistributedLock

    Registers the Oracle distributed lock provider with a connection factory delegate.

  • PostgresDistributedLockExtensions.AddPostgresDistributedLock

    Registers the PostgreSQL distributed lock provider with a `DbConnection` factory delegate.

  • RedisDistributedLockExtensions.AddRedisDistributedLock

    Registers Redis distributed lock services resolving the required `IConnectionMultiplexer` from the service provider.

  • SqlServerDistributedLockExtensions.AddSqlServerDistributedLock

    Registers SQL Server distributed lock services using the specified connection factory delegate.

  • SqliteDistributedLockExtensions.AddSqliteDistributedLock

    Registers SQLite distributed lock services using the specified connection factory delegate.

Key Public Types & Contracts

  • EricksonLopez.DistributedLock.Abstractions.CompositeDistributedLockHandle (class)

    Represents a composite distributed lock handle holding multiple underlying resource locks acquired in canonical order.

  • EricksonLopez.DistributedLock.Abstractions.DistributedLockAttribute (class)

    Specifies declarative distributed mutual exclusion for target classes or methods.

  • EricksonLopez.DistributedLock.Abstractions.DistributedLockErrors (class)

    Provides predefined standard domain errors for distributed locking failures.

  • EricksonLopez.DistributedLock.Abstractions.DistributedLockExtensions (class)

    Provides extension methods for `IDistributedLockProvider` to execute operations within a distributed lock scope.

  • EricksonLopez.DistributedLock.Abstractions.DistributedLockMetrics (class)

    Provides OpenTelemetry instrumentation and metrics for distributed lock operations.

  • EricksonLopez.DistributedLock.Abstractions.IDistributedLockHandle (interface)

    Defines a contract for a distributed lock handle whose disposal releases the acquired lock.

  • EricksonLopez.DistributedLock.Abstractions.IDistributedLockProvider (interface)

    Defines a contract for coordinating distributed mutual exclusion across process boundaries.

  • EricksonLopez.DistributedLock.MariaDb.MariaDbDistributedLockHandle (class)

    Represents an active MariaDB user-level lock handle that releases the lock upon disposal.

  • EricksonLopez.DistributedLock.MariaDb.MariaDbDistributedLockProvider (class)

    Provides distributed locks backed by MariaDB user-level locking functions.

  • EricksonLopez.DistributedLock.MariaDb.MariaDbLockOptions (class)

    Specifies configuration options for the MariaDB distributed lock provider.

  • EricksonLopez.DistributedLock.MariaDb.MariaDbTransactionLockExtensions (class)

    Provides extension methods for acquiring MariaDB locks within active database transactions.

  • EricksonLopez.DistributedLock.MySql.MySqlDistributedLockHandle (class)

    Represents an active MySQL user-level lock handle that releases the lock upon disposal.

14. Verified Performance Benchmarks#

All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).

No non-MEGA-AUDIT `BenchmarkDotNet.Artifacts` files were verified for this library in the snapshot (`hasBenchmarks: false`).

15. Release History & NuGet vs Repo Status#

Version lag detected: NuGet.org latest published version is v1.0.0, while local repository HEAD is at v2.1.0.

VersionSourcePublished DateSummary
v1.0.0 ↗github2026-09-22Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.DistributedLock.Abstractions` | `1.0.0` | | `EricksonLopez.DistributedLock.PostgreSql` | `1.0.0` | | `EricksonLopez.DistributedLock.SqlServer` | `1.0.0` | | `EricksonLopez.DistributedLock.MySql` | `1.0.0` | | `EricksonLopez.DistributedLock.MariaDb` | `1.0.0` | | `EricksonLopez.DistributedLock.Oracle`...
v1.0.0 ↗nuget2026-09-22Published EricksonLopez.DistributedLock.Abstractions 1.0.0 to NuGet.org.

Libraries in the same tier, architectural layer, or directly paired via dependency edges.

17. Documentation, API Reference & Portal Links#

Per-library conceptual Starlight pages expand in M4; API Reference pages expand in M3.2.

18. Source Repository, License & Contributing#

Released under the MIT License. All assemblies follow EricksonLopez.* build invariants: explicit imports, strong-name signing (`EricksonLopez.snk`), and ASCII author metadata (`Erickson Lopez`).

19. Troubleshooting, Pitfalls & Migration Guidance#

  • Install EricksonLopez.DistributedLock.Abstractions for domain/application interfaces and one concrete provider package in Infrastructure.
  • Version lag detected: NuGet.org latest published version is v1.0.0, while local repository HEAD is at v2.1.0.

20. Quality & Verification Evidence#

Strong-Name Signing (`EricksonLopez.snk`)
EricksonLopez.snk
`ImplicitUsings=disable`
disable
XML Documentation Extraction
Verified (9 namespaces, 43 types, 225 members)
MSBuild AOT / Trim Attributes
8 Full / 0 Partial / 0 Incompatible / 0 N/A
BenchmarkDotNet Artifacts
0 total (0 measured, 0 na_error)

Explicit Verification Boundaries & Limitations

  • All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.