forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event.go
122 lines (106 loc) · 2.83 KB
/
Event.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// automatically generated by the FlatBuffers compiler, do not modify
package schema
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type Event struct {
_tab flatbuffers.Table
}
func GetRootAsEvent(buf []byte, offset flatbuffers.UOffsetT) *Event {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &Event{}
x.Init(buf, n+offset)
return x
}
func (rcv *Event) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *Event) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *Event) TimestampNs() int64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.GetInt64(o + rcv._tab.Pos)
}
return 0
}
func (rcv *Event) MutateTimestampNs(n int64) bool {
return rcv._tab.MutateInt64Slot(4, n)
}
func (rcv *Event) TargetPath() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *Event) Action() byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.GetByte(o + rcv._tab.Pos)
}
return 0
}
func (rcv *Event) MutateAction(n byte) bool {
return rcv._tab.MutateByteSlot(8, n)
}
func (rcv *Event) Source() byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.GetByte(o + rcv._tab.Pos)
}
return 0
}
func (rcv *Event) MutateSource(n byte) bool {
return rcv._tab.MutateByteSlot(10, n)
}
func (rcv *Event) Info(obj *Metadata) *Metadata {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
x := rcv._tab.Indirect(o + rcv._tab.Pos)
if obj == nil {
obj = new(Metadata)
}
obj.Init(rcv._tab.Bytes, x)
return obj
}
return nil
}
func (rcv *Event) Hashes(obj *Hash) *Hash {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
x := rcv._tab.Indirect(o + rcv._tab.Pos)
if obj == nil {
obj = new(Hash)
}
obj.Init(rcv._tab.Bytes, x)
return obj
}
return nil
}
func EventStart(builder *flatbuffers.Builder) {
builder.StartObject(6)
}
func EventAddTimestampNs(builder *flatbuffers.Builder, timestampNs int64) {
builder.PrependInt64Slot(0, timestampNs, 0)
}
func EventAddTargetPath(builder *flatbuffers.Builder, targetPath flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(targetPath), 0)
}
func EventAddAction(builder *flatbuffers.Builder, action byte) {
builder.PrependByteSlot(2, action, 0)
}
func EventAddSource(builder *flatbuffers.Builder, source byte) {
builder.PrependByteSlot(3, source, 0)
}
func EventAddInfo(builder *flatbuffers.Builder, info flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(info), 0)
}
func EventAddHashes(builder *flatbuffers.Builder, hashes flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(hashes), 0)
}
func EventEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}