Skip to content
Leader docs0.4

Single, group, and strategic contracts

Latest stable Based on Leader release 0.4.0

Understand what each model guarantees—and what work partitioning remains outside the library.

One lock name permits at most one compliant owner. The action is still at-least-once from a business perspective when leases expire or callers retry, so external effects need idempotency.

A group exposes up to maxLeaders independent slots and reports activeCount, availableSlots, and isFull. Slot ownership limits concurrency but does not assign unique work. Group event projections may omit the concrete leaders because revoke events do not always identify a slot.

Strategic election separates candidate registration from winner selection. Built-ins include FIFO, seeded random, and scored selection with idle-time, success-rate, recent-success, and weighted scorers. It optimizes placement; it does not by itself provide a distributed lock for arbitrary shared writes.