Skip to content

dflockd-client

A Python client for dflockd — a distributed FIFO lock and counting-semaphore server.

Features

  • Sync and async clients with the same API surface
  • Distributed locks and counting semaphores with FIFO ordering
  • Single-phase acquire and two-phase enqueue + wait
  • Background lease renewal so you can hold a lock as long as the work takes
  • Multi-server sharding (CRC-32; cross-language compatible)
  • TLS and shared-secret authentication
  • Zero runtime dependencies; Python 3.12+

At a glance

from dflockd_client import SyncDistributedLock

with SyncDistributedLock("my-key") as lock:
    # critical section — lease auto-renews in the background
    print(f"acquired: {lock.token}")
from dflockd_client import SyncDistributedSemaphore

with SyncDistributedSemaphore("pool", limit=3) as sem:
    # up to 3 holders at once
    ...

Where to go next