File
Blob: kv/aof/proto/mutation_vtproto.pb.go
| 1 | // Code generated by protoc-gen-go-vtproto. DO NOT EDIT. |
| 2 | // protoc-gen-go-vtproto version: v0.6.0 |
| 3 | // source: kv/aof/proto/mutation.proto |
| 4 | |
| 5 | package proto |
| 6 | |
| 7 | import ( |
| 8 | fmt "fmt" |
| 9 | protohelpers "github.com/planetscale/vtprotobuf/protohelpers" |
| 10 | protocol "go.miragespace.co/specter/spec/protocol" |
| 11 | proto "google.golang.org/protobuf/proto" |
| 12 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
| 13 | io "io" |
| 14 | sync "sync" |
| 15 | ) |
| 16 | |
| 17 | const ( |
| 18 | // Verify that this generated code is sufficiently up-to-date. |
| 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) |
| 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. |
| 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) |
| 22 | ) |
| 23 | |
| 24 | func (m *Mutation) MarshalVT() (dAtA []byte, err error) { |
| 25 | if m == nil { |
| 26 | return nil, nil |
| 27 | } |
| 28 | size := m.SizeVT() |
| 29 | dAtA = make([]byte, size) |
| 30 | n, err := m.MarshalToSizedBufferVT(dAtA[:size]) |
| 31 | if err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | return dAtA[:n], nil |
| 35 | } |
| 36 | |
| 37 | func (m *Mutation) MarshalToVT(dAtA []byte) (int, error) { |
| 38 | size := m.SizeVT() |
| 39 | return m.MarshalToSizedBufferVT(dAtA[:size]) |
| 40 | } |
| 41 | |
| 42 | func (m *Mutation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { |
| 43 | if m == nil { |
| 44 | return 0, nil |
| 45 | } |
| 46 | i := len(dAtA) |
| 47 | _ = i |
| 48 | var l int |
| 49 | _ = l |
| 50 | if m.unknownFields != nil { |
| 51 | i -= len(m.unknownFields) |
| 52 | copy(dAtA[i:], m.unknownFields) |
| 53 | } |
| 54 | if len(m.Values) > 0 { |
| 55 | for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { |
| 56 | if vtmsg, ok := interface{}(m.Values[iNdEx]).(interface { |
| 57 | MarshalToSizedBufferVT([]byte) (int, error) |
| 58 | }); ok { |
| 59 | size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) |
| 60 | if err != nil { |
| 61 | return 0, err |
| 62 | } |
| 63 | i -= size |
| 64 | i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) |
| 65 | } else { |
| 66 | encoded, err := proto.Marshal(m.Values[iNdEx]) |
| 67 | if err != nil { |
| 68 | return 0, err |
| 69 | } |
| 70 | i -= len(encoded) |
| 71 | copy(dAtA[i:], encoded) |
| 72 | i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) |
| 73 | } |
| 74 | i-- |
| 75 | dAtA[i] = 0x1 |
| 76 | i-- |
| 77 | dAtA[i] = 0xa2 |
| 78 | } |
| 79 | } |
| 80 | if len(m.Keys) > 0 { |
| 81 | for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { |
| 82 | i -= len(m.Keys[iNdEx]) |
| 83 | copy(dAtA[i:], m.Keys[iNdEx]) |
| 84 | i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Keys[iNdEx]))) |
| 85 | i-- |
| 86 | dAtA[i] = 0x52 |
| 87 | } |
| 88 | } |
| 89 | if len(m.Value) > 0 { |
| 90 | i -= len(m.Value) |
| 91 | copy(dAtA[i:], m.Value) |
| 92 | i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Value))) |
| 93 | i-- |
| 94 | dAtA[i] = 0x1a |
| 95 | } |
| 96 | if len(m.Key) > 0 { |
| 97 | i -= len(m.Key) |
| 98 | copy(dAtA[i:], m.Key) |
| 99 | i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Key))) |
| 100 | i-- |
| 101 | dAtA[i] = 0x12 |
| 102 | } |
| 103 | if m.Type != 0 { |
| 104 | i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) |
| 105 | i-- |
| 106 | dAtA[i] = 0x8 |
| 107 | } |
| 108 | return len(dAtA) - i, nil |
| 109 | } |
| 110 | |
| 111 | var vtprotoPool_Mutation = sync.Pool{ |
| 112 | New: func() interface{} { |
| 113 | return &Mutation{} |
| 114 | }, |
| 115 | } |
| 116 | |
| 117 | func (m *Mutation) ResetVT() { |
| 118 | if m != nil { |
| 119 | f0 := m.Key[:0] |
| 120 | f1 := m.Value[:0] |
| 121 | f2 := m.Keys[:0] |
| 122 | for _, mm := range m.Values { |
| 123 | mm.Reset() |
| 124 | } |
| 125 | f3 := m.Values[:0] |
| 126 | m.Reset() |
| 127 | m.Key = f0 |
| 128 | m.Value = f1 |
| 129 | m.Keys = f2 |
| 130 | m.Values = f3 |
| 131 | } |
| 132 | } |
| 133 | func (m *Mutation) ReturnToVTPool() { |
| 134 | if m != nil { |
| 135 | m.ResetVT() |
| 136 | vtprotoPool_Mutation.Put(m) |
| 137 | } |
| 138 | } |
| 139 | func MutationFromVTPool() *Mutation { |
| 140 | return vtprotoPool_Mutation.Get().(*Mutation) |
| 141 | } |
| 142 | func (m *Mutation) SizeVT() (n int) { |
| 143 | if m == nil { |
| 144 | return 0 |
| 145 | } |
| 146 | var l int |
| 147 | _ = l |
| 148 | if m.Type != 0 { |
| 149 | n += 1 + protohelpers.SizeOfVarint(uint64(m.Type)) |
| 150 | } |
| 151 | l = len(m.Key) |
| 152 | if l > 0 { |
| 153 | n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 154 | } |
| 155 | l = len(m.Value) |
| 156 | if l > 0 { |
| 157 | n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 158 | } |
| 159 | if len(m.Keys) > 0 { |
| 160 | for _, b := range m.Keys { |
| 161 | l = len(b) |
| 162 | n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 163 | } |
| 164 | } |
| 165 | if len(m.Values) > 0 { |
| 166 | for _, e := range m.Values { |
| 167 | if size, ok := interface{}(e).(interface { |
| 168 | SizeVT() int |
| 169 | }); ok { |
| 170 | l = size.SizeVT() |
| 171 | } else { |
| 172 | l = proto.Size(e) |
| 173 | } |
| 174 | n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 175 | } |
| 176 | } |
| 177 | n += len(m.unknownFields) |
| 178 | return n |
| 179 | } |
| 180 | |
| 181 | func (m *Mutation) UnmarshalVT(dAtA []byte) error { |
| 182 | l := len(dAtA) |
| 183 | iNdEx := 0 |
| 184 | for iNdEx < l { |
| 185 | preIndex := iNdEx |
| 186 | var wire uint64 |
| 187 | for shift := uint(0); ; shift += 7 { |
| 188 | if shift >= 64 { |
| 189 | return protohelpers.ErrIntOverflow |
| 190 | } |
| 191 | if iNdEx >= l { |
| 192 | return io.ErrUnexpectedEOF |
| 193 | } |
| 194 | b := dAtA[iNdEx] |
| 195 | iNdEx++ |
| 196 | wire |= uint64(b&0x7F) << shift |
| 197 | if b < 0x80 { |
| 198 | break |
| 199 | } |
| 200 | } |
| 201 | fieldNum := int32(wire >> 3) |
| 202 | wireType := int(wire & 0x7) |
| 203 | if wireType == 4 { |
| 204 | return fmt.Errorf("proto: Mutation: wiretype end group for non-group") |
| 205 | } |
| 206 | if fieldNum <= 0 { |
| 207 | return fmt.Errorf("proto: Mutation: illegal tag %d (wire type %d)", fieldNum, wire) |
| 208 | } |
| 209 | switch fieldNum { |
| 210 | case 1: |
| 211 | if wireType != 0 { |
| 212 | return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
| 213 | } |
| 214 | m.Type = 0 |
| 215 | for shift := uint(0); ; shift += 7 { |
| 216 | if shift >= 64 { |
| 217 | return protohelpers.ErrIntOverflow |
| 218 | } |
| 219 | if iNdEx >= l { |
| 220 | return io.ErrUnexpectedEOF |
| 221 | } |
| 222 | b := dAtA[iNdEx] |
| 223 | iNdEx++ |
| 224 | m.Type |= MutationType(b&0x7F) << shift |
| 225 | if b < 0x80 { |
| 226 | break |
| 227 | } |
| 228 | } |
| 229 | case 2: |
| 230 | if wireType != 2 { |
| 231 | return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) |
| 232 | } |
| 233 | var byteLen int |
| 234 | for shift := uint(0); ; shift += 7 { |
| 235 | if shift >= 64 { |
| 236 | return protohelpers.ErrIntOverflow |
| 237 | } |
| 238 | if iNdEx >= l { |
| 239 | return io.ErrUnexpectedEOF |
| 240 | } |
| 241 | b := dAtA[iNdEx] |
| 242 | iNdEx++ |
| 243 | byteLen |= int(b&0x7F) << shift |
| 244 | if b < 0x80 { |
| 245 | break |
| 246 | } |
| 247 | } |
| 248 | if byteLen < 0 { |
| 249 | return protohelpers.ErrInvalidLength |
| 250 | } |
| 251 | postIndex := iNdEx + byteLen |
| 252 | if postIndex < 0 { |
| 253 | return protohelpers.ErrInvalidLength |
| 254 | } |
| 255 | if postIndex > l { |
| 256 | return io.ErrUnexpectedEOF |
| 257 | } |
| 258 | m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) |
| 259 | if m.Key == nil { |
| 260 | m.Key = []byte{} |
| 261 | } |
| 262 | iNdEx = postIndex |
| 263 | case 3: |
| 264 | if wireType != 2 { |
| 265 | return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) |
| 266 | } |
| 267 | var byteLen int |
| 268 | for shift := uint(0); ; shift += 7 { |
| 269 | if shift >= 64 { |
| 270 | return protohelpers.ErrIntOverflow |
| 271 | } |
| 272 | if iNdEx >= l { |
| 273 | return io.ErrUnexpectedEOF |
| 274 | } |
| 275 | b := dAtA[iNdEx] |
| 276 | iNdEx++ |
| 277 | byteLen |= int(b&0x7F) << shift |
| 278 | if b < 0x80 { |
| 279 | break |
| 280 | } |
| 281 | } |
| 282 | if byteLen < 0 { |
| 283 | return protohelpers.ErrInvalidLength |
| 284 | } |
| 285 | postIndex := iNdEx + byteLen |
| 286 | if postIndex < 0 { |
| 287 | return protohelpers.ErrInvalidLength |
| 288 | } |
| 289 | if postIndex > l { |
| 290 | return io.ErrUnexpectedEOF |
| 291 | } |
| 292 | m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) |
| 293 | if m.Value == nil { |
| 294 | m.Value = []byte{} |
| 295 | } |
| 296 | iNdEx = postIndex |
| 297 | case 10: |
| 298 | if wireType != 2 { |
| 299 | return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) |
| 300 | } |
| 301 | var byteLen int |
| 302 | for shift := uint(0); ; shift += 7 { |
| 303 | if shift >= 64 { |
| 304 | return protohelpers.ErrIntOverflow |
| 305 | } |
| 306 | if iNdEx >= l { |
| 307 | return io.ErrUnexpectedEOF |
| 308 | } |
| 309 | b := dAtA[iNdEx] |
| 310 | iNdEx++ |
| 311 | byteLen |= int(b&0x7F) << shift |
| 312 | if b < 0x80 { |
| 313 | break |
| 314 | } |
| 315 | } |
| 316 | if byteLen < 0 { |
| 317 | return protohelpers.ErrInvalidLength |
| 318 | } |
| 319 | postIndex := iNdEx + byteLen |
| 320 | if postIndex < 0 { |
| 321 | return protohelpers.ErrInvalidLength |
| 322 | } |
| 323 | if postIndex > l { |
| 324 | return io.ErrUnexpectedEOF |
| 325 | } |
| 326 | m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) |
| 327 | copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) |
| 328 | iNdEx = postIndex |
| 329 | case 20: |
| 330 | if wireType != 2 { |
| 331 | return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) |
| 332 | } |
| 333 | var msglen int |
| 334 | for shift := uint(0); ; shift += 7 { |
| 335 | if shift >= 64 { |
| 336 | return protohelpers.ErrIntOverflow |
| 337 | } |
| 338 | if iNdEx >= l { |
| 339 | return io.ErrUnexpectedEOF |
| 340 | } |
| 341 | b := dAtA[iNdEx] |
| 342 | iNdEx++ |
| 343 | msglen |= int(b&0x7F) << shift |
| 344 | if b < 0x80 { |
| 345 | break |
| 346 | } |
| 347 | } |
| 348 | if msglen < 0 { |
| 349 | return protohelpers.ErrInvalidLength |
| 350 | } |
| 351 | postIndex := iNdEx + msglen |
| 352 | if postIndex < 0 { |
| 353 | return protohelpers.ErrInvalidLength |
| 354 | } |
| 355 | if postIndex > l { |
| 356 | return io.ErrUnexpectedEOF |
| 357 | } |
| 358 | if len(m.Values) == cap(m.Values) { |
| 359 | m.Values = append(m.Values, &protocol.KVTransfer{}) |
| 360 | } else { |
| 361 | m.Values = m.Values[:len(m.Values)+1] |
| 362 | if m.Values[len(m.Values)-1] == nil { |
| 363 | m.Values[len(m.Values)-1] = &protocol.KVTransfer{} |
| 364 | } |
| 365 | } |
| 366 | if unmarshal, ok := interface{}(m.Values[len(m.Values)-1]).(interface { |
| 367 | UnmarshalVT([]byte) error |
| 368 | }); ok { |
| 369 | if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { |
| 370 | return err |
| 371 | } |
| 372 | } else { |
| 373 | if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Values[len(m.Values)-1]); err != nil { |
| 374 | return err |
| 375 | } |
| 376 | } |
| 377 | iNdEx = postIndex |
| 378 | default: |
| 379 | iNdEx = preIndex |
| 380 | skippy, err := protohelpers.Skip(dAtA[iNdEx:]) |
| 381 | if err != nil { |
| 382 | return err |
| 383 | } |
| 384 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 385 | return protohelpers.ErrInvalidLength |
| 386 | } |
| 387 | if (iNdEx + skippy) > l { |
| 388 | return io.ErrUnexpectedEOF |
| 389 | } |
| 390 | m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) |
| 391 | iNdEx += skippy |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | if iNdEx > l { |
| 396 | return io.ErrUnexpectedEOF |
| 397 | } |
| 398 | return nil |
| 399 | } |