-
Notifications
You must be signed in to change notification settings - Fork 23
/
agent_status.go
47 lines (39 loc) · 901 Bytes
/
agent_status.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
package types
const (
agentStatusOffsetFlag = 0
agentStatusOffsetDomain = 8
agentStatusOffsetIndex = 40
agentStatusSize = 48
)
// AgentStatus is the agent status interface.
type AgentStatus interface {
// Flag is the current status flag of the agent.
Flag() AgentFlagType
// Domain that agent is assigned to.
Domain() uint32
// Index of the agent in list of agents.
Index() uint32
}
type agentStatus struct {
flag AgentFlagType
domain uint32
index uint32
}
// NewAgentStatus creates a new agent status.
func NewAgentStatus(flag AgentFlagType, domain, index uint32) AgentStatus {
return &agentStatus{
flag: flag,
domain: domain,
index: index,
}
}
func (s agentStatus) Flag() AgentFlagType {
return s.flag
}
func (s agentStatus) Domain() uint32 {
return s.domain
}
func (s agentStatus) Index() uint32 {
return s.index
}
var _ AgentStatus = agentStatus{}