Debian Codegraph @

envoy/extensions/load_balancing_policies/maglev/v3/maglev_vtproto.pb.go

raw
1 //go:build vtprotobuf
2 // +build vtprotobuf
3
4 // Code generated by protoc-gen-go-vtproto. DO NOT EDIT.
5 // source: envoy/extensions/load_balancing_policies/maglev/v3/maglev.proto
6
7 package maglevv3
8
9 import (
10 protohelpers "github.com/planetscale/vtprotobuf/protohelpers"
11 wrapperspb "github.com/planetscale/vtprotobuf/types/known/wrapperspb"
12 proto "google.golang.org/protobuf/proto"
13 protoimpl "google.golang.org/protobuf/runtime/protoimpl"
14 )
15
16 const (
17 // Verify that this generated code is sufficiently up-to-date.
18 _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
19 // Verify that runtime/protoimpl is sufficiently up-to-date.
20 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
21 )
22
23 func (m *Maglev) MarshalVTStrict() (dAtA []byte, err error) {
24 if m == nil {
25 return nil, nil
26 }
27 size := m.SizeVT()
28 dAtA = make([]byte, size)
29 n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size])
30 if err != nil {
31 return nil, err
32 }
33 return dAtA[:n], nil
34 }
35
36 func (m *Maglev) MarshalToVTStrict(dAtA []byte) (int, error) {
37 size := m.SizeVT()
38 return m.MarshalToSizedBufferVTStrict(dAtA[:size])
39 }
40
41 func (m *Maglev) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) {
42 if m == nil {
43 return 0, nil
44 }
45 i := len(dAtA)
46 _ = i
47 var l int
48 _ = l
49 if m.unknownFields != nil {
50 i -= len(m.unknownFields)
51 copy(dAtA[i:], m.unknownFields)
52 }
53 if m.LocalityWeightedLbConfig != nil {
54 if vtmsg, ok := interface{}(m.LocalityWeightedLbConfig).(interface {
55 MarshalToSizedBufferVTStrict([]byte) (int, error)
56 }); ok {
57 size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i])
58 if err != nil {
59 return 0, err
60 }
61 i -= size
62 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
63 } else {
64 encoded, err := proto.Marshal(m.LocalityWeightedLbConfig)
65 if err != nil {
66 return 0, err
67 }
68 i -= len(encoded)
69 copy(dAtA[i:], encoded)
70 i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded)))
71 }
72 i--
73 dAtA[i] = 0x1a
74 }
75 if m.ConsistentHashingLbConfig != nil {
76 if vtmsg, ok := interface{}(m.ConsistentHashingLbConfig).(interface {
77 MarshalToSizedBufferVTStrict([]byte) (int, error)
78 }); ok {
79 size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i])
80 if err != nil {
81 return 0, err
82 }
83 i -= size
84 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
85 } else {
86 encoded, err := proto.Marshal(m.ConsistentHashingLbConfig)
87 if err != nil {
88 return 0, err
89 }
90 i -= len(encoded)
91 copy(dAtA[i:], encoded)
92 i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded)))
93 }
94 i--
95 dAtA[i] = 0x12
96 }
97 if m.TableSize != nil {
98 size, err := (*wrapperspb.UInt64Value)(m.TableSize).MarshalToSizedBufferVTStrict(dAtA[:i])
99 if err != nil {
100 return 0, err
101 }
102 i -= size
103 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
104 i--
105 dAtA[i] = 0xa
106 }
107 return len(dAtA) - i, nil
108 }
109
110 func (m *Maglev) SizeVT() (n int) {
111 if m == nil {
112 return 0
113 }
114 var l int
115 _ = l
116 if m.TableSize != nil {
117 l = (*wrapperspb.UInt64Value)(m.TableSize).SizeVT()
118 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
119 }
120 if m.ConsistentHashingLbConfig != nil {
121 if size, ok := interface{}(m.ConsistentHashingLbConfig).(interface {
122 SizeVT() int
123 }); ok {
124 l = size.SizeVT()
125 } else {
126 l = proto.Size(m.ConsistentHashingLbConfig)
127 }
128 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
129 }
130 if m.LocalityWeightedLbConfig != nil {
131 if size, ok := interface{}(m.LocalityWeightedLbConfig).(interface {
132 SizeVT() int
133 }); ok {
134 l = size.SizeVT()
135 } else {
136 l = proto.Size(m.LocalityWeightedLbConfig)
137 }
138 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
139 }
140 n += len(m.unknownFields)
141 return n
142 }