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
Accounts, tokens and scopes.
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 Acquire mints a fresh token, so a function cannot extend a lock it holds. Size the TTL for the whole job. 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