Distributed Lock Service  ·  View 06 of 26  ·  3 · Structure

Layered Architecture

Seven layers, dependencies pointing down, and the one rule that no caller reaches the lock log directly.

Editable source SVG draw.io All views
Callers Job schedulers Replica sets Entity workers Client Client library Go · Java · Python Session keepalive TTL / 3 Fence callback required argument Access Envoy fan-in mTLS · ring hash SPIRE agent X.509 SVID Coordination Lock arbiter Go · stateless truth Wait queue in memory Admin API inspect · force Record Lock log · coord etcd · 5 members Lock log · entity etcd · 3 per shard Class registry LockClass CRDs Evidence Audit tailer resumes by revision Audit store ClickHouse Audit archive MinIO object lock Platform Prometheus OTel Collector Argo CD Keycloak acquire gRPC mTLS Txn watch Layered Architecture Application we own Interface / broker Security / platform Queue / topic Data store synchronous event / async Dependencies point down. Nothing below Coordination calls up, and no caller reaches etcd directly. v 1.0 · owner Platform Architecture · date 2026-09

Decisions

  • The client library is a layer, not a convenience. Session keepalive, the local deadline and the fence callback live there because they must keep working while the network is failing.
  • Coordination holds no durable state. Record holds all of it. Evidence is derived from Record and can lag or be rebuilt without touching a single grant.
  • Platform services are consumed, not embedded. Replacing Keycloak or the metrics stack changes a configuration file, not the lock protocol.

What would break the layering

  • A team embedding clientv3 and writing lock keys themselves. The etcd RBAC role that grants write access exists only for the arbiter and the Admin API.
  • An arbiter feature that caches holder state to save a round trip. A cache that answers who holds is a second source of truth.

Assumptions

  • Client libraries ship first in Go, then Java and Python. Each has the fence callback as a required constructor argument, so a caller cannot forget it.