mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
b7b4b0229b
Summary: This makes core independently buildable again, and adds a small script to run as a sanity check. Test Plan: checked that build_core.sh succeeds Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D2558
25 lines
812 B
TypeScript
25 lines
812 B
TypeScript
/**
|
|
* Get a revokable named exclusive lock with a TTL. This is convenient for housekeeping
|
|
* tasks, which can be done by any server, but should preferably be only done by one
|
|
* at a time.
|
|
*/
|
|
export interface IElectionStore {
|
|
/**
|
|
* Try to get a lock called <name> for a specified duration. If the named lock
|
|
* has already been taken, null is returned, otherwise a secret is returned.
|
|
* The secret can be used to remove the lock before the duration has expired.
|
|
*/
|
|
getElection(name: string, durationInMs: number): Promise<string|null>;
|
|
|
|
/**
|
|
* Remove a named lock, presenting the secret returned by getElection() as
|
|
* a cross-check.
|
|
*/
|
|
removeElection(name: string, electionKey: string): Promise<void>;
|
|
|
|
/**
|
|
* Close down access to the store.
|
|
*/
|
|
close(): Promise<void>;
|
|
}
|