-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipe.go
51 lines (41 loc) · 881 Bytes
/
pipe.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
package daemon
type PipeMessageType int
const (
SupervisorToProcess PipeMessageType = iota + 1
ProcessToSupervisor
)
type ProcessBehavior int
const (
WantSafetyClose ProcessBehavior = iota + 1
)
func (pmt PipeMessageType) String() (s string) {
switch pmt {
case SupervisorToProcess:
s = "The Process sends messages to the Supervisor"
case ProcessToSupervisor:
s = "The Supervisor sends messages to the Process"
default:
s = "Unknown PipeMessageType"
}
return
}
func (pb ProcessBehavior) String() (s string) {
switch pb {
case WantSafetyClose:
s = "Expect a safe exit"
default:
s = "Unknown ProcessBehavior"
}
return
}
type PipeMessage struct {
Type PipeMessageType
Behavior ProcessBehavior
}
type NamedPipeMessageType int
const (
PrintInformation NamedPipeMessageType = iota + 1
)
type NamedPipeMessage struct {
Api NamedPipeMessageType
}