-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage.go
More file actions
67 lines (55 loc) · 1.14 KB
/
message.go
File metadata and controls
67 lines (55 loc) · 1.14 KB
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
package main
import "fmt"
type dMsg interface {
getDataMsgDescription() string
getDataMsgBody() *dMsgBody
getDataMsgOrigin() string
}
//
// Concrete meta data can be returned from message types.
type dMsgMetaData struct {
Path string
Identifier string
}
type dMsgJSON struct {
DMsgType string
DMsgBody dMsgBody
DMsgOrigin string
}
type dMsgBody struct {
Timestamp int64
Node string
Path string
Updates map[string]interface{}
Deletes []string
SyncResponse bool
}
func (d *dMsgJSON) getDataMsgDescription() string {
//_, id := m.getMetaDataIdentifier()
return fmt.Sprintf("JSON message [%s]", d.DMsgType)
}
func (d *dMsgJSON) getDataMsgBody() *dMsgBody {
return &d.DMsgBody
}
func (d *dMsgJSON) getDataMsgOrigin() string {
return d.DMsgOrigin
}
type msgID int
const (
// Used to request to shutdown, expects ACK on respChan
shutdown msgID = iota
// Request to report back on pipeline node state
report
// Acknowledge a request.
ack
)
// Control message channel type
type cMsg struct {
id msgID
data []byte
respChan chan *cMsg
}
type msgStats struct {
msgsOK uint64
msgsNOK uint64
}