drift Docs
Start
What is Drift?
The tour, if you are new here.
Use cases
Whether Drift does your thing.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, four unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Route gates, API keys and your account.
Security
Boundaries, sandboxing and hardening.
Troubleshooting
Error codes
What went wrong, and what to do about it.
Legal
Acceptable use
What a slice may not be used for.
Data processing
The DPA, and every sub-processor.

Backbone Locks

Distributed locks stop two workers doing the same job at once. Acquire returns a server-minted token you present to Release:

Go
token, 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 ...
}

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.

Every SDK's Acquire mints a fresh token on each call, so calling it again to stay alive reads as a different holder and is refused while your own lock is live. Size the TTL for the whole job, or use the pattern below to hold one for longer.

The CLI names the owner itself, which is what lets it renew:

Shell
drift backbone lock acquire payout-42 worker-1 --ttl 30
drift backbone lock renew   payout-42 worker-1 --ttl 30
drift backbone lock release payout-42 worker-1

The Go SDK has the same capability. Lock.AcquireAs(name, owner, ttl) takes a stable owner you choose: it renews the lease if you already hold it, takes it if free or expired, and refuses if someone else holds it. Lock.Renew(name, token, ttl) then extends it without releasing first:

Go
token, err := drift.Backbone.Lock.AcquireAs("payout:42", "worker-1", 30)
if err == nil {
    drift.Backbone.Lock.Renew("payout:42", token, 30)   // extend without losing the lock
}

The other five SDKs expose only the fresh-token Acquire, with no lease equivalent yet.