forked from rocicorp/mono
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.ts
More file actions
31 lines (28 loc) · 1.01 KB
/
service.ts
File metadata and controls
31 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export interface Service {
readonly id: string;
/**
* `run` is called once by the Service Runner to run the service.
* The returned Promise resolves when the service stops, either because
* {@link stop()} was called, or because the service
* has completed its work. If the Promise rejects with an error, the
* Service Runner will restart it with exponential backoff.
*/
run(): Promise<void>;
/**
* Called to signal the service to stop. This is generally only used
* in tests.
*/
stop(): Promise<void>;
}
export interface ActivityBasedService extends Service {
/**
* Requests that service continue running if not already shutting down.
* This is applicable to services whose life cycle is tied to external
* activity and shutdown after a period of inactivity.
*
* @return `true` if the service will continue running for its
* configured keepalive interval, or `false` if it has
* already shut down or begun the shutdown process.
*/
keepalive(): boolean;
}