-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathcommands.go
44 lines (35 loc) · 1.06 KB
/
commands.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
package resource
import (
"fmt"
"github.com/open-horizon/anax/events"
)
// This worker command is used to tell the worker than the node is configured and it can init itself.
type NodeConfigCommand struct {
msg *events.EdgeRegisteredExchangeMessage
}
func (n NodeConfigCommand) String() string {
return n.ShortString()
}
func (n NodeConfigCommand) ShortString() string {
return fmt.Sprintf("NodeConfig Command, Msg: %v", n.msg)
}
func NewNodeConfigCommand(msg *events.EdgeRegisteredExchangeMessage) *NodeConfigCommand {
return &NodeConfigCommand{
msg: msg,
}
}
// This worker command is used to tell the worker than the node is done shutting down and so it can terminate itself.
type NodeUnconfigCommand struct {
msg *events.NodeShutdownMessage
}
func (n NodeUnconfigCommand) String() string {
return n.ShortString()
}
func (n NodeUnconfigCommand) ShortString() string {
return fmt.Sprintf("NodeUnconfig Command, Msg: %v", n.msg)
}
func NewNodeUnconfigCommand(msg *events.NodeShutdownMessage) *NodeUnconfigCommand {
return &NodeUnconfigCommand{
msg: msg,
}
}