Debian Codegraph @

envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash_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/ring_hash/v3/ring_hash.proto
6
7 package ring_hashv3
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 *RingHash) 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 *RingHash) MarshalToVTStrict(dAtA []byte) (int, error) {
37 size := m.SizeVT()
38 return m.MarshalToSizedBufferVTStrict(dAtA[:size])
39 }
40
41 func (m *RingHash) 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] = 0x3a
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] = 0x32
96 }
97 if m.HashBalanceFactor != nil {
98 size, err := (*wrapperspb.UInt32Value)(m.HashBalanceFactor).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] = 0x2a
106 }
107 if m.UseHostnameForHashing {
108 i--
109 if m.UseHostnameForHashing {
110 dAtA[i] = 1
111 } else {
112 dAtA[i] = 0
113 }
114 i--
115 dAtA[i] = 0x20
116 }
117 if m.MaximumRingSize != nil {
118 size, err := (*wrapperspb.UInt64Value)(m.MaximumRingSize).MarshalToSizedBufferVTStrict(dAtA[:i])
119 if err != nil {
120 return 0, err
121 }
122 i -= size
123 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
124 i--
125 dAtA[i] = 0x1a
126 }
127 if m.MinimumRingSize != nil {
128 size, err := (*wrapperspb.UInt64Value)(m.MinimumRingSize).MarshalToSizedBufferVTStrict(dAtA[:i])
129 if err != nil {
130 return 0, err
131 }
132 i -= size
133 i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
134 i--
135 dAtA[i] = 0x12
136 }
137 if m.HashFunction != 0 {
138 i = protohelpers.EncodeVarint(dAtA, i, uint64(m.HashFunction))
139 i--
140 dAtA[i] = 0x8
141 }
142 return len(dAtA) - i, nil
143 }
144
145 func (m *RingHash) SizeVT() (n int) {
146 if m == nil {
147 return 0
148 }
149 var l int
150 _ = l
151 if m.HashFunction != 0 {
152 n += 1 + protohelpers.SizeOfVarint(uint64(m.HashFunction))
153 }
154 if m.MinimumRingSize != nil {
155 l = (*wrapperspb.UInt64Value)(m.MinimumRingSize).SizeVT()
156 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
157 }
158 if m.MaximumRingSize != nil {
159 l = (*wrapperspb.UInt64Value)(m.MaximumRingSize).SizeVT()
160 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
161 }
162 if m.UseHostnameForHashing {
163 n += 2
164 }
165 if m.HashBalanceFactor != nil {
166 l = (*wrapperspb.UInt32Value)(m.HashBalanceFactor).SizeVT()
167 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
168 }
169 if m.ConsistentHashingLbConfig != nil {
170 if size, ok := interface{}(m.ConsistentHashingLbConfig).(interface {
171 SizeVT() int
172 }); ok {
173 l = size.SizeVT()
174 } else {
175 l = proto.Size(m.ConsistentHashingLbConfig)
176 }
177 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
178 }
179 if m.LocalityWeightedLbConfig != nil {
180 if size, ok := interface{}(m.LocalityWeightedLbConfig).(interface {
181 SizeVT() int
182 }); ok {
183 l = size.SizeVT()
184 } else {
185 l = proto.Size(m.LocalityWeightedLbConfig)
186 }
187 n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
188 }
189 n += len(m.unknownFields)
190 return n
191 }