Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/compute/log.ts
1447 views
1
import type {
2
State,
3
SpendLimit,
4
HealthCheck,
5
ShutdownTime,
6
} from "@cocalc/util/db-schema/compute-servers";
7
8
interface Event {
9
event: "compute-server";
10
server_id: number;
11
}
12
13
interface StateChange {
14
action: "state";
15
state: State;
16
}
17
18
interface ConfigurationChange {
19
action: "configuration";
20
changes: { [param: string]: { from: any; to: any } };
21
}
22
23
// DEPRECATED: for backward compatibility only...
24
export interface AutomaticShutdownEntry {
25
action: "automatic-shutdown";
26
automatic_shutdown: any;
27
}
28
29
export interface HealthCheckFailureEntry {
30
action: "health-check-failure";
31
healthCheck: HealthCheck;
32
}
33
34
export interface IdleTimeoutEntry {
35
action: "idle-timeout";
36
idle_timeout: number;
37
}
38
39
export interface ShutdownTimeEntry {
40
action: "shutdown-time";
41
shutdownTime: ShutdownTime;
42
}
43
44
export interface SpendLimitEntry {
45
action: "spend-limit";
46
spendLimit: SpendLimit;
47
total: number;
48
}
49
50
interface Error {
51
action: "error";
52
error: string;
53
}
54
55
export type ComputeServerEvent = (
56
| ConfigurationChange
57
| StateChange
58
| Error
59
| AutomaticShutdownEntry
60
| HealthCheckFailureEntry
61
| IdleTimeoutEntry
62
| ShutdownTimeEntry
63
| SpendLimitEntry
64
) &
65
Event;
66
67
export type ComputeServerEventLogEntry =
68
| ConfigurationChange
69
| StateChange
70
| AutomaticShutdownEntry
71
| HealthCheckFailureEntry
72
| IdleTimeoutEntry
73
| ShutdownTimeEntry
74
| SpendLimitEntry
75
| Error;
76
77