This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
imsg.rony.go
162 lines (135 loc) · 3.41 KB
/
imsg.rony.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
// Code generated by Rony's protoc plugin; DO NOT EDIT.
package rony
import (
registry "github.com/ronaksoft/rony/registry"
proto "google.golang.org/protobuf/proto"
sync "sync"
)
const C_TunnelMessage int64 = 3271476222
type poolTunnelMessage struct {
pool sync.Pool
}
func (p *poolTunnelMessage) Get() *TunnelMessage {
x, ok := p.pool.Get().(*TunnelMessage)
if !ok {
return &TunnelMessage{}
}
return x
}
func (p *poolTunnelMessage) Put(x *TunnelMessage) {
x.SenderID = x.SenderID[:0]
x.SenderReplicaSet = 0
x.Store = x.Store[:0]
if x.Envelope != nil {
PoolMessageEnvelope.Put(x.Envelope)
x.Envelope = nil
}
p.pool.Put(x)
}
var PoolTunnelMessage = poolTunnelMessage{}
func (x *TunnelMessage) DeepCopy(z *TunnelMessage) {
z.SenderID = append(z.SenderID[:0], x.SenderID...)
z.SenderReplicaSet = x.SenderReplicaSet
for idx := range x.Store {
if x.Store[idx] != nil {
xx := PoolKeyValue.Get()
x.Store[idx].DeepCopy(xx)
z.Store = append(z.Store, xx)
}
}
if x.Envelope != nil {
z.Envelope = PoolMessageEnvelope.Get()
x.Envelope.DeepCopy(z.Envelope)
}
}
func (x *TunnelMessage) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *TunnelMessage) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{}.Unmarshal(b, x)
}
const C_RaftCommand int64 = 2919813429
type poolRaftCommand struct {
pool sync.Pool
}
func (p *poolRaftCommand) Get() *RaftCommand {
x, ok := p.pool.Get().(*RaftCommand)
if !ok {
return &RaftCommand{}
}
return x
}
func (p *poolRaftCommand) Put(x *RaftCommand) {
x.Sender = x.Sender[:0]
x.Store = x.Store[:0]
if x.Envelope != nil {
PoolMessageEnvelope.Put(x.Envelope)
x.Envelope = nil
}
p.pool.Put(x)
}
var PoolRaftCommand = poolRaftCommand{}
func (x *RaftCommand) DeepCopy(z *RaftCommand) {
z.Sender = append(z.Sender[:0], x.Sender...)
for idx := range x.Store {
if x.Store[idx] != nil {
xx := PoolKeyValue.Get()
x.Store[idx].DeepCopy(xx)
z.Store = append(z.Store, xx)
}
}
if x.Envelope != nil {
z.Envelope = PoolMessageEnvelope.Get()
x.Envelope.DeepCopy(z.Envelope)
}
}
func (x *RaftCommand) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *RaftCommand) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{}.Unmarshal(b, x)
}
const C_EdgeNode int64 = 999040174
type poolEdgeNode struct {
pool sync.Pool
}
func (p *poolEdgeNode) Get() *EdgeNode {
x, ok := p.pool.Get().(*EdgeNode)
if !ok {
return &EdgeNode{}
}
return x
}
func (p *poolEdgeNode) Put(x *EdgeNode) {
x.ServerID = x.ServerID[:0]
x.ReplicaSet = 0
x.ShardRangeMin = 0
x.ShardRangeMax = 0
x.RaftPort = 0
x.RaftState = 0
x.GatewayAddr = x.GatewayAddr[:0]
x.TunnelAddr = x.TunnelAddr[:0]
p.pool.Put(x)
}
var PoolEdgeNode = poolEdgeNode{}
func (x *EdgeNode) DeepCopy(z *EdgeNode) {
z.ServerID = append(z.ServerID[:0], x.ServerID...)
z.ReplicaSet = x.ReplicaSet
z.ShardRangeMin = x.ShardRangeMin
z.ShardRangeMax = x.ShardRangeMax
z.RaftPort = x.RaftPort
z.RaftState = x.RaftState
z.GatewayAddr = append(z.GatewayAddr[:0], x.GatewayAddr...)
z.TunnelAddr = append(z.TunnelAddr[:0], x.TunnelAddr...)
}
func (x *EdgeNode) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *EdgeNode) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{}.Unmarshal(b, x)
}
func init() {
registry.RegisterConstructor(3271476222, "TunnelMessage")
registry.RegisterConstructor(2919813429, "RaftCommand")
registry.RegisterConstructor(999040174, "EdgeNode")
}