Skip to main content

acquire

Function acquire 

Source
pub async fn acquire(
    pool: &Pool,
    page_id: i64,
    user_id: i64,
    force: bool,
) -> Result<AcquireOutcome, ExecError>
Expand description

Best-effort acquire: returns Acquired if the page is free or already owned by user_id, else Held with the other user’s row. Refreshes expires_at on every call when we own the lock.

force=true (admin force-unlock) deletes any existing row and inserts a fresh one owned by user_id. Callers are responsible for the audit-log entry.

§Errors

Driver / query failures.