-
Notifications
You must be signed in to change notification settings - Fork 130
/
wsproto.go
66 lines (56 loc) · 1.53 KB
/
wsproto.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
package core
// MessageType defines type of message
type MessageType string
// StatusType defines type job status
type StatusType string
// StatType defines type of resource status
type StatType string
// types of messages
const (
MsgLogin MessageType = "login"
MsgLogout MessageType = "logout"
MsgTask MessageType = "task"
MsgInfo MessageType = "info"
MsgError MessageType = "error"
MsgResourceStats MessageType = "resourcestats"
MsgJobInfo MessageType = "jobinfo"
)
// JobInfo types
const (
JobCompleted StatusType = "complete"
JobStarted StatusType = "started"
JobFailed StatusType = "failed"
)
// ResourceStats types
const (
ResourceRelease StatType = "release"
ResourceCapture StatType = "capture"
)
// Message struct
type Message struct {
Type MessageType `json:"type"`
Content []byte `json:"content"`
Success bool `json:"success"`
}
// LoginDetails struct
type LoginDetails struct {
Name string `json:"name"`
SynapseID string `json:"synapse_id"`
SecretKey string `json:"secret_key"`
CPU float32 `json:"cpu"`
RAM int64 `json:"ram"`
}
// ResourceStats struct for CPU, RAM details
type ResourceStats struct {
Status StatType `json:"status"`
CPU float32 `json:"cpu"`
RAM int64 `json:"ram"`
}
// JobInfo stuct for job updates info
type JobInfo struct {
Status StatusType `json:"status"`
JobID string `json:"job_id"`
ID string `json:"id"`
Mode string `json:"mode"`
BuildID string `json:"build_id"`
}