No description
  • Go 93%
  • Makefile 5.4%
  • Dockerfile 1.6%
Find a file
zemdregon afbc760c09
Some checks are pending
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
CI / build (push) Waiting to run
CI / docker (push) Blocked by required conditions
chore(deps): bump docker/setup-buildx-action to v4
Self-hosted CI workflows only.
2026-08-10 18:13:54 -05:00
.github/workflows chore(deps): bump docker/setup-buildx-action to v4 2026-08-10 18:13:54 -05:00
cmd/module chore: add CI/LICENSE and align module bootstrap 2026-07-22 19:09:33 -05:00
internal fix(ci): self-hosted runners; packaging v0.1.3 2026-08-10 10:33:47 -05:00
.env.example fix: change default gRPC port to avoid collision with cache-local 2026-08-07 10:46:37 -05:00
.gitignore Initial commit 2026-07-03 12:03:05 -05:00
.golangci.yml docs: document single-node and shared-volume lock limits (#5) 2026-08-09 20:08:56 -05:00
CHANGELOG.md fix(ci): self-hosted runners; packaging v0.1.3 2026-08-10 10:33:47 -05:00
COMPATIBILITY.md fix(ci): self-hosted runners; packaging v0.1.3 2026-08-10 10:33:47 -05:00
Dockerfile Initial commit 2026-07-03 12:03:05 -05:00
go.mod Add SettingsProvider for live lock DB path and sweep interval. (#6) 2026-08-10 03:43:06 -05:00
go.sum Add SettingsProvider for live lock DB path and sweep interval. (#6) 2026-08-10 03:43:06 -05:00
LICENSE chore: add CI/LICENSE and align module bootstrap 2026-07-22 19:09:33 -05:00
Makefile Initial commit 2026-07-03 12:03:05 -05:00
muxcore.json fix(ci): self-hosted runners; packaging v0.1.3 2026-08-10 10:33:47 -05:00
README.md fix(ci): self-hosted runners; packaging v0.1.3 2026-08-10 10:33:47 -05:00

Distributed Lock SQLite

SQLite-backed lock provider for mesh-wide coordination on a single MuxCore host (or carefully constrained shared volume).

A gRPC sidecar that implements DistributedLockProvider using a local SQLite database with WAL mode. TTL-based lock expiration, automatic expired lock sweeping, and re-acquire by the same holder. Without this module, core has no durable lock capability.

Not multi-writer HA. See COMPATIBILITY.md for single-node vs shared-volume vs multi-module limits.

Single-node expectations

This module is the laptop / single-host lock provider:

Expectation Detail
Topology One distributed-lock-sqlite process per mesh, LOCK_DB_PATH on local disk
Coordination Callers on that mesh dial this module; locks are not shared across separate SQLite files
Restart Rows survive process restart; abandoned holders expire via TTL + sweeper
Not supported Multi-writer HA, multiple lock modules on one DB, or NFS/shared-volume multi-host writers

For cluster-wide locks, use an external store (Redis SET NX, etcd, Postgres advisory locks). Full matrix: COMPATIBILITY.md.

Key Features

  • TTL-based locks — Locks auto-expire after a configurable duration
  • Periodic sweeper — Background goroutine purges expired locks at LOCK_SWEEP_INTERVAL (default 10s)
  • Re-acquire support — Same holder can re-acquire without releasing first (issues a new token)
  • Token-based unlock — Each lock acquisition returns a unique cryptographically random token required to unlock
  • Renew API — Extend a held lock's TTL before it expires

Configuration

Env var Default Description
LOCK_GRPC_ADDR :9612 gRPC listen address
LOCK_DB_PATH /var/lib/distributed-lock-sqlite/locks.db SQLite database path
LOCK_SWEEP_INTERVAL 10s Expired lock sweep interval
MUXCORE_INSECURE_DISABLE_TLS unset Set true to disable TLS for the module SDK

Usage

export MUXCORE_INSECURE_DISABLE_TLS=true
distributed-lock-sqlite

Contract

Implements DistributedLockProvider (pkg/contracts). Registers capability: distributed.lock.