GetLock

Fetches a lock by name.

Read-only and safe to retry.

Request

{
  "namespace_name": "UserObjects",
  "lock_name": "users/123/profile"
}

Response

  • Returns NotFound if the namespace does not exist.
  • Always returns a value, even if the lock has never been acquired — in that case the response shows state: UNLOCKED and an empty holders list.
  • Each holder’s metadata is the optional, opaque map attached at acquire time — see Metadata.

Currently held:

{
  "lock": {
    "name": "users/123/profile",
    "state": "LOCK_STATE_EXCLUSIVE_LOCKED",
    "locked_at": 1695826239671432000,
    "last_activity_at": 1695826239671432000,
    "lock_holders": [
      {
        "lease_id": "ll_NfKKeiPbP18NFeU3lLGrRWWgDJRB",
        "locked_at": 1695826239671432000,
        "metadata": {
          "host": "node-1"
        }
      }
    ]
  }
}

Not held:

{
  "lock": {
    "name": "users/123/profile",
    "state": "LOCK_STATE_UNLOCKED",
    "locked_at": 0,
    "last_activity_at": 0,
    "lock_holders": []
  }
}