Dossier API – acquireAdvisoryLock, renewAdvisoryLock and releaseAdvisoryLock

acquireAdvisoryLock is used to create a new advisory lock and acquire it. renewAdvisoryLock is used to renew an existing advisory lock and keep it alive. releaseAdvisoryLock is used to release an acquired advisory lock so it can me acquired by others.

The main usage of an advisory lock is to coordinate distributed programmatic changes to Dossier, e.g. content migration.

interface DossierClient {
acquireAdvisoryLock(
name: string,
options: AdvisoryLockOptions,
): PromiseResult<AdvisoryLockPayload, "BadRequest" | "Conflict" | "Generic">;

renewAdvisoryLock(
name: string,
handle: number,
): PromiseResult<AdvisoryLockPayload, "BadRequest" | "NotFound" | "Generic">;

releaseAdvisoryLock(
name: string,
handle: number,
): PromiseResult<
AdvisoryLockReleasePayload,
"BadRequest" | "NotFound" | "Generic"
>;
}

interface AdvisoryLockOptions {
leaseDuration: number;
}

interface AdvisoryLockPayload {
name: string;
handle: number;
}

interface AdvisoryLockReleasePayload {
name: string;
}