-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubscriptionProperties.go
187 lines (166 loc) · 5.95 KB
/
SubscriptionProperties.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package datalayer
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type SubscriptionPropertiesT struct {
Id string
KeepaliveInterval uint32
PublishInterval uint32
Rules []*PropertyT
ErrorInterval uint32
}
func (t *SubscriptionPropertiesT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
idOffset := builder.CreateString(t.Id)
rulesOffset := flatbuffers.UOffsetT(0)
if t.Rules != nil {
rulesLength := len(t.Rules)
rulesOffsets := make([]flatbuffers.UOffsetT, rulesLength)
for j := 0; j < rulesLength; j++ {
rulesOffsets[j] = t.Rules[j].Pack(builder)
}
SubscriptionPropertiesStartRulesVector(builder, rulesLength)
for j := rulesLength - 1; j >= 0; j-- {
builder.PrependUOffsetT(rulesOffsets[j])
}
rulesOffset = builder.EndVector(rulesLength)
}
SubscriptionPropertiesStart(builder)
SubscriptionPropertiesAddId(builder, idOffset)
SubscriptionPropertiesAddKeepaliveInterval(builder, t.KeepaliveInterval)
SubscriptionPropertiesAddPublishInterval(builder, t.PublishInterval)
SubscriptionPropertiesAddRules(builder, rulesOffset)
SubscriptionPropertiesAddErrorInterval(builder, t.ErrorInterval)
return SubscriptionPropertiesEnd(builder)
}
func (rcv *SubscriptionProperties) UnPackTo(t *SubscriptionPropertiesT) {
t.Id = string(rcv.Id())
t.KeepaliveInterval = rcv.KeepaliveInterval()
t.PublishInterval = rcv.PublishInterval()
rulesLength := rcv.RulesLength()
t.Rules = make([]*PropertyT, rulesLength)
for j := 0; j < rulesLength; j++ {
x := Property{}
rcv.Rules(&x, j)
t.Rules[j] = x.UnPack()
}
t.ErrorInterval = rcv.ErrorInterval()
}
func (rcv *SubscriptionProperties) UnPack() *SubscriptionPropertiesT {
if rcv == nil { return nil }
t := &SubscriptionPropertiesT{}
rcv.UnPackTo(t)
return t
}
type SubscriptionProperties struct {
_tab flatbuffers.Table
}
func GetRootAsSubscriptionProperties(buf []byte, offset flatbuffers.UOffsetT) *SubscriptionProperties {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &SubscriptionProperties{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsSubscriptionProperties(buf []byte, offset flatbuffers.UOffsetT) *SubscriptionProperties {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &SubscriptionProperties{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *SubscriptionProperties) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *SubscriptionProperties) Table() flatbuffers.Table {
return rcv._tab
}
/// user identification for subscribtion Use it update and dispose the old subscription
func (rcv *SubscriptionProperties) Id() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
/// user identification for subscribtion Use it update and dispose the old subscription
/// keepalive in milli seconds for subscription - this time is used to detect life status of providers
func (rcv *SubscriptionProperties) KeepaliveInterval() uint32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.GetUint32(o + rcv._tab.Pos)
}
return 60000
}
/// keepalive in milli seconds for subscription - this time is used to detect life status of providers
func (rcv *SubscriptionProperties) MutateKeepaliveInterval(n uint32) bool {
return rcv._tab.MutateUint32Slot(6, n)
}
/// time in milli seconds for upper limit of publish messages to not get flooded with new messages
func (rcv *SubscriptionProperties) PublishInterval() uint32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.GetUint32(o + rcv._tab.Pos)
}
return 1000
}
/// time in milli seconds for upper limit of publish messages to not get flooded with new messages
func (rcv *SubscriptionProperties) MutatePublishInterval(n uint32) bool {
return rcv._tab.MutateUint32Slot(8, n)
}
/// Rules for subscription
func (rcv *SubscriptionProperties) Rules(obj *Property, j int) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
x := rcv._tab.Vector(o)
x += flatbuffers.UOffsetT(j) * 4
x = rcv._tab.Indirect(x)
obj.Init(rcv._tab.Bytes, x)
return true
}
return false
}
func (rcv *SubscriptionProperties) RulesLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
/// Rules for subscription
/// time in milli seconds to re-read data if an error was received for a nodex
func (rcv *SubscriptionProperties) ErrorInterval() uint32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return rcv._tab.GetUint32(o + rcv._tab.Pos)
}
return 10000
}
/// time in milli seconds to re-read data if an error was received for a nodex
func (rcv *SubscriptionProperties) MutateErrorInterval(n uint32) bool {
return rcv._tab.MutateUint32Slot(12, n)
}
func SubscriptionPropertiesStart(builder *flatbuffers.Builder) {
builder.StartObject(5)
}
func SubscriptionPropertiesAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0)
}
func SubscriptionPropertiesAddKeepaliveInterval(builder *flatbuffers.Builder, keepaliveInterval uint32) {
builder.PrependUint32Slot(1, keepaliveInterval, 60000)
}
func SubscriptionPropertiesAddPublishInterval(builder *flatbuffers.Builder, publishInterval uint32) {
builder.PrependUint32Slot(2, publishInterval, 1000)
}
func SubscriptionPropertiesAddRules(builder *flatbuffers.Builder, rules flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(rules), 0)
}
func SubscriptionPropertiesStartRulesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func SubscriptionPropertiesAddErrorInterval(builder *flatbuffers.Builder, errorInterval uint32) {
builder.PrependUint32Slot(4, errorInterval, 10000)
}
func SubscriptionPropertiesEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}