Skip to content

[Feature] Lease backends: etcd, Consul, Redis, Postgres advisory locks #439

Description

@pathosDev

Rationale

Lease backs split-brain resolution (LeaseMajority), singleton handover and shard-coordination safety — but only InMemory and Kubernetes implementations exist. Deployments outside K8s (bare VMs, Docker Compose, Nomad) currently have no production lease.

Scope

  • New Lease implementations with fencing tokens, following the KubernetesLease contract:
    • etcd (v3 HTTP/JSON gateway) — SDK-free via the built-in HttpClient,
    • Consul (sessions + KV acquire) — SDK-free via HttpClient,
    • Redis (SET NX PX + Lua renew) — via the existing optional ioredis peer; document the weaker guarantees (single-instance Redis, no Redlock claims),
    • Postgres advisory locks — via the existing optional pg peer.
  • HOCON selection under actor-ts.coordination.lease:
actor-ts.coordination.lease {
  backend = "etcd"             # in-memory | kubernetes | etcd | consul | redis | postgres
  etcd { endpoints = ["http://etcd:2379"] }
}
  • Per-backend caveats documented (failure modes, clock assumptions, fencing semantics).

Documentation

Coordination docs: backend matrix + per-backend page (EN + DE); config reference; CHANGELOG.

Acceptance

  • Contract test suite (acquire/renew/release/steal/fencing monotonicity) green per backend (containerized); LeaseMajority e2e passes with the etcd backend.

Non-goals

Distributed semaphores/counters (separate concern); multi-key transactions.

Relates

#160 (ServiceDiscovery Consul/AWS — the discovery half), #51/LeaseMajority (shipped). Dependency policy #419 (etcd/Consul SDK-free). Improvement program M8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions