This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
/
model.go
105 lines (94 loc) · 2.38 KB
/
model.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package api
import (
"fmt"
)
const (
RunningState = "RUNNING"
PendingState = "CLAIMED"
ErrorState = "UNCLAIMED"
CrashedState = "CRASHED"
UnknownState = "UNKNOWN"
InsufficientMemoryError = "Insufficient resources: memory"
)
type LRPIdentifier struct {
GUID, Version string
}
func (i *LRPIdentifier) ProcessGUID() string {
return fmt.Sprintf("%s-%s", i.GUID, i.Version)
}
// An LRP, or long-running-process, is a stateless process
// where the scheduler should attempt to keep N copies running,
// killing and recreating as needed to maintain that guarantee.
type LRP struct {
LRPIdentifier
ProcessType string
AppName string
AppGUID string
OrgName string
OrgGUID string
SpaceName string
SpaceGUID string
Image string
Command []string
Sidecars []Sidecar
PrivateRegistry *PrivateRegistry
Env map[string]string
Health Healthcheck
Ports []int32
TargetInstances int
RunningInstances int
MemoryMB int64
DiskMB int64
CPUWeight uint8
VolumeMounts []VolumeMount
LRP string
LastUpdated string
UserDefinedAnnotations map[string]string
}
type Sidecar struct {
Name string
Command []string
MemoryMB int64
Env map[string]string
}
type PrivateRegistry struct {
Server string
Username string
Password string
}
type VolumeMount struct {
MountPath string
ClaimName string
}
type Instance struct {
Index int
Since int64
State string
PlacementError string
}
type Healthcheck struct {
Type string
Port int32
Endpoint string
TimeoutMs uint
}
// A Task is a one-off process that is run exactly once and returns a
// result.
type Task struct {
GUID string
Name string
Image string
CompletionCallback string
PrivateRegistry *PrivateRegistry
Env map[string]string
Command []string
AppName string
AppGUID string
OrgName string
OrgGUID string
SpaceName string
SpaceGUID string
MemoryMB int64
DiskMB int64
CPUWeight uint8
}