Locks
drift.Backbone.Lock: distributed locks, so work is not done twice.
Signatures
// Acquire returns a token you pass back to Release
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 a function.
Every SDK
Acquire mints a fresh token, so a function cannot extend a lock it already holds. Pick a TTL that covers the work. The CLI names the owner itself, which is what lets drift backbone lock renew exist there and not here.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".