1
0
Fork 0
mirror of synced 2024-06-02 18:44:54 +12:00
budibase/packages/types/src/sdk/locks.ts
2022-10-25 13:37:26 +01:00

36 lines
750 B
TypeScript

export enum LockType {
/**
* If this lock is already held the attempted operation will not be performed.
* No retries will take place and no error will be thrown.
*/
TRY_ONCE = "try_once",
}
export enum LockName {
MIGRATIONS = "migrations",
TRIGGER_QUOTA = "trigger_quota",
}
export interface LockOptions {
/**
* The lock type determines which client to use
*/
type: LockType
/**
* The name for the lock
*/
name: LockName
/**
* The ttl to auto-expire the lock if not unlocked manually
*/
ttl: number
/**
* The suffix to add to the lock name for additional uniqueness
*/
nameSuffix?: string
/**
* This is a system-wide lock - don't use tenancy in lock key
*/
systemLock?: boolean
}