Locks
drift.Backbone.Lock: distributed locks, so work is not done twice.
Signatures
// Acquire mints a FRESH token every call; Release takes it back
Acquire(name string, ttlSeconds int) (string, error) · Release(name, token string) errortoken, err := drift.Backbone.Lock.Acquire("payout:42", 30) // hold for up to 30s
if err == nil {
defer drift.Backbone.Lock.Release("payout:42", token)
// ... do the work exactly once ...
}Size the TTL for the whole job
There is no renew from Acquire.
Go alone can hold a lock open
// AcquireAs and Renew: Go only, so far
AcquireAs(name, owner string, ttlSeconds int) (string, error) // renews if OWNER already holds it, takes it if free
Renew(name, token string, ttlSeconds int) error // extends a lock you already hold, by TOKENAcquireAs takes a stable owner you choose instead of a minted one, so calling it again under the same owner while your lock is still live extends the TTL instead of being refused: one call that means "renew if it's mine, take it if it's free or expired, refuse if someone else holds it." Renew extends a lock you already hold without releasing it first, and fails if the lock is gone, already expired, or owned by someone else, in which case treat that as "I am no longer the holder" rather than retrying into a second active one.
Neither exists yet in Python, Node.js, Ruby, PHP or Rust: size the TTL for the whole job there, as the WARNING above says. The CLI's own drift backbone lock renew names an owner explicitly the same way AcquireAs does, which is what lets it renew from outside a function regardless of which language deployed it.
A lock held by someone else answers 409, so the second worker backs off. Past your tier's concurrent-lock limit, Acquire answers 429. A TTL of zero or less becomes 30 seconds. Lock names are not charset-restricted, so payout:42 is fine.
Locks are not captured in a snapshot, so restoring one gives you no held locks, which is the correct outcome for a primitive whose whole meaning is "right now".