ARCHOS 525 BLUEPRINT · /d/dgm_distributed-lock-service
Distributed Lock Service (lease, fencing token, consensus store)
12 COMPONENTS · 15 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_distributed-lock-service) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_distributed-lock-service)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_distributed-lock-service" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Distributed Lock Service (lease, fencing token, consensus store) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0[("Job worker")]
gw_1["API gateway"]
lock_2[("Distributed lock")]
leader_3[("Consensus leader")]
f1_4[("Consensus follower 1")]
f2_5[("Consensus follower 2")]
res_6[("PostgreSQL")]
pdp_7["Policy decision point (PDP)"]
secrets_8[("Secrets manager")]
tsdb_9[("Time-series database (TSDB)")]
alerting_10[("Alerting")]
capacity_11["Capacity Estimate"]
client_0 -->|"1. Calls with JWT · HTTPS"| gw_1
gw_1 -->|"2. Asks lock · HTTP/2"| lock_2
lock_2 -->|"3. Creates key · HTTP/2"| leader_3
leader_3 -->|"4. Revision · HTTP/2"| lock_2
lock_2 -->|"5. Token · HTTP/2"| gw_1
gw_1 -->|"6. Granted · HTTPS"| client_0
client_0 -->|"7. Writes with token · SQL"| res_6
res_6 -->|"8. Accepts or rejects · SQL"| client_0
gw_1 -->|"Asks policy · HTTP/2"| pdp_7
secrets_8 -->|"JWT keys · HTTPS"| gw_1
leader_3 -->|"Replicates · TCP"| f1_4
leader_3 -->|"Replicates · TCP"| f2_5
lock_2 -->|"Exports (OTLP) · OTLP"| tsdb_9
res_6 -->|"Exports (OTLP) · OTLP"| tsdb_9
tsdb_9 -->|"Feeds alerts · HTTP"| alerting_10COMPONENT STACK (11)
- Job workerSTATEFULNeeds one writer at a time
- API gatewaySTATELESSChecks the JWT, then forwards
- Distributed lockSTATEFULGrants a Lease and a Fencing token
- Consensus leaderSTATEFULCommits on a majority of 3 members
- Consensus follower 1STATEFULCopies the leader's log
- Consensus follower 2STATEFULCopies the leader's log
- PostgreSQLSTATEFULRejects a token below the highest seen
- Policy decision point (PDP)STATELESSAllows or denies a lock per name
- Secrets managerSTATEFULHolds the JWT verification keys
- Time-series database (TSDB)STATEFULStores grants, expiries, rejections
- AlertingSTATEFULPages on rejections and no leader
REQUEST & DATA FLOW (15)
- Job worker → API gateway (Calls with JWT)[HTTPS]
- API gateway → Distributed lock (Asks lock)[HTTP/2]
- Distributed lock → Consensus leader (Creates key)[HTTP/2]
- Consensus leader → Distributed lock (Revision)[HTTP/2]
- Distributed lock → API gateway (Token)[HTTP/2]
- API gateway → Job worker (Granted)[HTTPS]
- Job worker → PostgreSQL (Writes with token)[SQL]
- PostgreSQL → Job worker (Accepts or rejects)[SQL]
- API gateway → Policy decision point (PDP) (Asks policy)[HTTP/2]
- Secrets manager → API gateway (JWT keys)[HTTPS]
- Consensus leader → Consensus follower 1 (Replicates)[TCP]
- Consensus leader → Consensus follower 2 (Replicates)[TCP]
- Distributed lock → Time-series database (TSDB) (Exports (OTLP))[OTLP]
- PostgreSQL → Time-series database (TSDB) (Exports (OTLP))[OTLP]