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
/
msg.rony.go
792 lines (608 loc) · 13.8 KB
/
msg.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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
// Code generated by Rony's protoc plugin; DO NOT EDIT.
// ProtoC ver. v3.17.3
// Rony ver. v0.16.24
// Source: msg.proto
package rony
import (
bytes "bytes"
sync "sync"
pools "github.com/ronaksoft/rony/pools"
registry "github.com/ronaksoft/rony/registry"
protojson "google.golang.org/protobuf/encoding/protojson"
proto "google.golang.org/protobuf/proto"
)
var _ = pools.Imported
const C_MessageEnvelope uint64 = 11385363697628734430
type poolMessageEnvelope struct {
pool sync.Pool
}
func (p *poolMessageEnvelope) Get() *MessageEnvelope {
x, ok := p.pool.Get().(*MessageEnvelope)
if !ok {
x = &MessageEnvelope{}
}
return x
}
func (p *poolMessageEnvelope) Put(x *MessageEnvelope) {
if x == nil {
return
}
x.Constructor = 0
x.RequestID = 0
x.JsonEncoded = false
x.Message = x.Message[:0]
x.Auth = x.Auth[:0]
for _, z := range x.Header {
PoolKeyValue.Put(z)
}
x.Header = x.Header[:0]
p.pool.Put(x)
}
var PoolMessageEnvelope = poolMessageEnvelope{}
func (x *MessageEnvelope) DeepCopy(z *MessageEnvelope) {
z.Constructor = x.Constructor
z.RequestID = x.RequestID
z.JsonEncoded = x.JsonEncoded
z.Message = append(z.Message[:0], x.Message...)
z.Auth = append(z.Auth[:0], x.Auth...)
for idx := range x.Header {
if x.Header[idx] == nil {
continue
}
xx := PoolKeyValue.Get()
x.Header[idx].DeepCopy(xx)
z.Header = append(z.Header, xx)
}
}
func (x *MessageEnvelope) Clone() *MessageEnvelope {
z := &MessageEnvelope{}
x.DeepCopy(z)
return z
}
func (x *MessageEnvelope) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *MessageEnvelope) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func factoryMessageEnvelope() registry.Message {
return &MessageEnvelope{}
}
const C_Ping uint64 = 3584172304239689728
type poolPing struct {
pool sync.Pool
}
func (p *poolPing) Get() *Ping {
x, ok := p.pool.Get().(*Ping)
if !ok {
x = &Ping{}
}
return x
}
func (p *poolPing) Put(x *Ping) {
if x == nil {
return
}
x.ID = 0
p.pool.Put(x)
}
var PoolPing = poolPing{}
func (x *Ping) DeepCopy(z *Ping) {
z.ID = x.ID
}
func (x *Ping) Clone() *Ping {
z := &Ping{}
x.DeepCopy(z)
return z
}
func (x *Ping) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *Ping) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *Ping) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *Ping) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryPing() registry.Message {
return &Ping{}
}
const C_Pong uint64 = 3584174915579805696
type poolPong struct {
pool sync.Pool
}
func (p *poolPong) Get() *Pong {
x, ok := p.pool.Get().(*Pong)
if !ok {
x = &Pong{}
}
return x
}
func (p *poolPong) Put(x *Pong) {
if x == nil {
return
}
x.ID = 0
p.pool.Put(x)
}
var PoolPong = poolPong{}
func (x *Pong) DeepCopy(z *Pong) {
z.ID = x.ID
}
func (x *Pong) Clone() *Pong {
z := &Pong{}
x.DeepCopy(z)
return z
}
func (x *Pong) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *Pong) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *Pong) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *Pong) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryPong() registry.Message {
return &Pong{}
}
const C_KeyValue uint64 = 9712539143259722476
type poolKeyValue struct {
pool sync.Pool
}
func (p *poolKeyValue) Get() *KeyValue {
x, ok := p.pool.Get().(*KeyValue)
if !ok {
x = &KeyValue{}
}
return x
}
func (p *poolKeyValue) Put(x *KeyValue) {
if x == nil {
return
}
x.Key = ""
x.Value = ""
p.pool.Put(x)
}
var PoolKeyValue = poolKeyValue{}
func (x *KeyValue) DeepCopy(z *KeyValue) {
z.Key = x.Key
z.Value = x.Value
}
func (x *KeyValue) Clone() *KeyValue {
z := &KeyValue{}
x.DeepCopy(z)
return z
}
func (x *KeyValue) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *KeyValue) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *KeyValue) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *KeyValue) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryKeyValue() registry.Message {
return &KeyValue{}
}
const C_MessageContainer uint64 = 8705479839606992738
type poolMessageContainer struct {
pool sync.Pool
}
func (p *poolMessageContainer) Get() *MessageContainer {
x, ok := p.pool.Get().(*MessageContainer)
if !ok {
x = &MessageContainer{}
}
return x
}
func (p *poolMessageContainer) Put(x *MessageContainer) {
if x == nil {
return
}
x.Length = 0
for _, z := range x.Envelopes {
PoolMessageEnvelope.Put(z)
}
x.Envelopes = x.Envelopes[:0]
x.SyncRun = false
p.pool.Put(x)
}
var PoolMessageContainer = poolMessageContainer{}
func (x *MessageContainer) DeepCopy(z *MessageContainer) {
z.Length = x.Length
for idx := range x.Envelopes {
if x.Envelopes[idx] == nil {
continue
}
xx := PoolMessageEnvelope.Get()
x.Envelopes[idx].DeepCopy(xx)
z.Envelopes = append(z.Envelopes, xx)
}
z.SyncRun = x.SyncRun
}
func (x *MessageContainer) Clone() *MessageContainer {
z := &MessageContainer{}
x.DeepCopy(z)
return z
}
func (x *MessageContainer) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *MessageContainer) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *MessageContainer) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *MessageContainer) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryMessageContainer() registry.Message {
return &MessageContainer{}
}
const C_Error uint64 = 3300063058275074048
type poolError struct {
pool sync.Pool
}
func (p *poolError) Get() *Error {
x, ok := p.pool.Get().(*Error)
if !ok {
x = &Error{}
}
return x
}
func (p *poolError) Put(x *Error) {
if x == nil {
return
}
x.Code = ""
x.Items = ""
x.Description = ""
p.pool.Put(x)
}
var PoolError = poolError{}
func (x *Error) DeepCopy(z *Error) {
z.Code = x.Code
z.Items = x.Items
z.Description = x.Description
}
func (x *Error) Clone() *Error {
z := &Error{}
x.DeepCopy(z)
return z
}
func (x *Error) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *Error) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *Error) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *Error) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryError() registry.Message {
return &Error{}
}
const C_Redirect uint64 = 12783312295490183931
type poolRedirect struct {
pool sync.Pool
}
func (p *poolRedirect) Get() *Redirect {
x, ok := p.pool.Get().(*Redirect)
if !ok {
x = &Redirect{}
}
return x
}
func (p *poolRedirect) Put(x *Redirect) {
if x == nil {
return
}
x.Reason = 0
for _, z := range x.Edges {
PoolEdge.Put(z)
}
x.Edges = x.Edges[:0]
x.WaitInSec = 0
p.pool.Put(x)
}
var PoolRedirect = poolRedirect{}
func (x *Redirect) DeepCopy(z *Redirect) {
z.Reason = x.Reason
for idx := range x.Edges {
if x.Edges[idx] == nil {
continue
}
xx := PoolEdge.Get()
x.Edges[idx].DeepCopy(xx)
z.Edges = append(z.Edges, xx)
}
z.WaitInSec = x.WaitInSec
}
func (x *Redirect) Clone() *Redirect {
z := &Redirect{}
x.DeepCopy(z)
return z
}
func (x *Redirect) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *Redirect) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *Redirect) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *Redirect) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryRedirect() registry.Message {
return &Redirect{}
}
const C_Edge uint64 = 3661905149145645056
type poolEdge struct {
pool sync.Pool
}
func (p *poolEdge) Get() *Edge {
x, ok := p.pool.Get().(*Edge)
if !ok {
x = &Edge{}
}
return x
}
func (p *poolEdge) Put(x *Edge) {
if x == nil {
return
}
x.ReplicaSet = 0
x.ServerID = ""
x.HostPorts = x.HostPorts[:0]
p.pool.Put(x)
}
var PoolEdge = poolEdge{}
func (x *Edge) DeepCopy(z *Edge) {
z.ReplicaSet = x.ReplicaSet
z.ServerID = x.ServerID
z.HostPorts = append(z.HostPorts[:0], x.HostPorts...)
}
func (x *Edge) Clone() *Edge {
z := &Edge{}
x.DeepCopy(z)
return z
}
func (x *Edge) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *Edge) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *Edge) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *Edge) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryEdge() registry.Message {
return &Edge{}
}
const C_Edges uint64 = 3202852853167161344
type poolEdges struct {
pool sync.Pool
}
func (p *poolEdges) Get() *Edges {
x, ok := p.pool.Get().(*Edges)
if !ok {
x = &Edges{}
}
return x
}
func (p *poolEdges) Put(x *Edges) {
if x == nil {
return
}
for _, z := range x.Nodes {
PoolEdge.Put(z)
}
x.Nodes = x.Nodes[:0]
p.pool.Put(x)
}
var PoolEdges = poolEdges{}
func (x *Edges) DeepCopy(z *Edges) {
for idx := range x.Nodes {
if x.Nodes[idx] == nil {
continue
}
xx := PoolEdge.Get()
x.Nodes[idx].DeepCopy(xx)
z.Nodes = append(z.Nodes, xx)
}
}
func (x *Edges) Clone() *Edges {
z := &Edges{}
x.DeepCopy(z)
return z
}
func (x *Edges) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *Edges) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *Edges) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *Edges) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryEdges() registry.Message {
return &Edges{}
}
const C_GetNodes uint64 = 17614373553603896039
type poolGetNodes struct {
pool sync.Pool
}
func (p *poolGetNodes) Get() *GetNodes {
x, ok := p.pool.Get().(*GetNodes)
if !ok {
x = &GetNodes{}
}
return x
}
func (p *poolGetNodes) Put(x *GetNodes) {
if x == nil {
return
}
x.ReplicaSet = x.ReplicaSet[:0]
p.pool.Put(x)
}
var PoolGetNodes = poolGetNodes{}
func (x *GetNodes) DeepCopy(z *GetNodes) {
z.ReplicaSet = append(z.ReplicaSet[:0], x.ReplicaSet...)
}
func (x *GetNodes) Clone() *GetNodes {
z := &GetNodes{}
x.DeepCopy(z)
return z
}
func (x *GetNodes) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *GetNodes) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *GetNodes) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *GetNodes) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryGetNodes() registry.Message {
return &GetNodes{}
}
const C_GetAllNodes uint64 = 2426091802953969362
type poolGetAllNodes struct {
pool sync.Pool
}
func (p *poolGetAllNodes) Get() *GetAllNodes {
x, ok := p.pool.Get().(*GetAllNodes)
if !ok {
x = &GetAllNodes{}
}
return x
}
func (p *poolGetAllNodes) Put(x *GetAllNodes) {
if x == nil {
return
}
p.pool.Put(x)
}
var PoolGetAllNodes = poolGetAllNodes{}
func (x *GetAllNodes) DeepCopy(z *GetAllNodes) {
}
func (x *GetAllNodes) Clone() *GetAllNodes {
z := &GetAllNodes{}
x.DeepCopy(z)
return z
}
func (x *GetAllNodes) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *GetAllNodes) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *GetAllNodes) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *GetAllNodes) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryGetAllNodes() registry.Message {
return &GetAllNodes{}
}
const C_HttpBody uint64 = 4148778432730789982
type poolHttpBody struct {
pool sync.Pool
}
func (p *poolHttpBody) Get() *HttpBody {
x, ok := p.pool.Get().(*HttpBody)
if !ok {
x = &HttpBody{}
}
return x
}
func (p *poolHttpBody) Put(x *HttpBody) {
if x == nil {
return
}
x.ContentType = ""
for _, z := range x.Header {
PoolKeyValue.Put(z)
}
x.Header = x.Header[:0]
x.Body = x.Body[:0]
p.pool.Put(x)
}
var PoolHttpBody = poolHttpBody{}
func (x *HttpBody) DeepCopy(z *HttpBody) {
z.ContentType = x.ContentType
for idx := range x.Header {
if x.Header[idx] == nil {
continue
}
xx := PoolKeyValue.Get()
x.Header[idx].DeepCopy(xx)
z.Header = append(z.Header, xx)
}
z.Body = append(z.Body[:0], x.Body...)
}
func (x *HttpBody) Clone() *HttpBody {
z := &HttpBody{}
x.DeepCopy(z)
return z
}
func (x *HttpBody) Unmarshal(b []byte) error {
return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x)
}
func (x *HttpBody) Marshal() ([]byte, error) {
return proto.Marshal(x)
}
func (x *HttpBody) UnmarshalJSON(b []byte) error {
return protojson.Unmarshal(b, x)
}
func (x *HttpBody) MarshalJSON() ([]byte, error) {
return protojson.Marshal(x)
}
func factoryHttpBody() registry.Message {
return &HttpBody{}
}
// register constructors of the messages to the registry package
func init() {
registry.Register(11385363697628734430, "MessageEnvelope", factoryMessageEnvelope)
registry.Register(3584172304239689728, "Ping", factoryPing)
registry.Register(3584174915579805696, "Pong", factoryPong)
registry.Register(9712539143259722476, "KeyValue", factoryKeyValue)
registry.Register(8705479839606992738, "MessageContainer", factoryMessageContainer)
registry.Register(3300063058275074048, "Error", factoryError)
registry.Register(12783312295490183931, "Redirect", factoryRedirect)
registry.Register(3661905149145645056, "Edge", factoryEdge)
registry.Register(3202852853167161344, "Edges", factoryEdges)
registry.Register(17614373553603896039, "GetNodes", factoryGetNodes)
registry.Register(2426091802953969362, "GetAllNodes", factoryGetAllNodes)
registry.Register(4148778432730789982, "HttpBody", factoryHttpBody)
}
var _ = bytes.MinRead