diff --git a/Makefile b/Makefile index 4c9f6c0a..b79f200c 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,8 @@ gen-testproto: get-grpc-testproto gen-wkt-testproto install testproto/proto2/scalars.proto \ testproto/unsafe/unsafe.proto \ testproto/unique/unique.proto \ + testproto/slab/slab.proto \ + testproto/slab/nested.proto \ || exit 1; $(PROTOBUF_ROOT)/src/protoc \ --proto_path=testproto \ diff --git a/README.md b/README.md index 647ddb93..b08ec389 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,12 @@ The following features can be generated: - `unmarshal_unsafe` generates a `func (p *YourProto) UnmarshalVTUnsafe(data []byte)` that behaves like `UnmarshalVT`, except it unsafely casts slices of data to `bytes` and `string` fields instead of copying them to newly allocated arrays, so that it performs less allocations. **Data received from the wire has to be left untouched for the lifetime of the message.** Otherwise, the message's `bytes` and `string` fields can be corrupted. +- `unmarshal_slab` generates a `func (p *YourProto) UnmarshalVTSlab(data []byte) error` for every message that opts in (see the usage section below), plus unexported arena-threaded decoding helpers for the message types reachable from it within the same `.proto` file. `UnmarshalVTSlab` decodes exactly like `UnmarshalVT` — same merge semantics, same unknown-field retention, no aliasing of the input buffer — but allocates repeated and nested message elements, map values, and scalar presence pointers (`optional` scalars, strings and enums) from chunked slabs. A cheap counting pre-pass over the top-level wire format reserves exactly-sized chunks for the repeated message fields before decoding, so N element allocations collapse into O(log N) chunk allocations. On repeated-message-heavy payloads this typically cuts decode allocations by 40–60% and decode time by 10–30%. Payloads smaller than `protohelpers.SlabUnmarshalThreshold` (256 bytes), and payloads in which the pre-pass finds fewer than `protohelpers.SlabUnmarshalMinCount` (4) repeated message elements, skip the arena and fall back to `UnmarshalVT`: slabs win by amortizing many same-type allocations, so tiny or barely-repeated messages would pay the arena setup without the payoff. + + **The trade-off**: slab elements are carved out of shared chunks. A decoded message behaves exactly like an independently allocated one, except that **retaining any pointer into the message graph (a sub-message, a repeated element, an `optional` field pointer) keeps that pointer's whole chunk alive**. This is why the feature is strictly opt-in per message: use it for messages whose lifetime ends with the RPC or request that carried them, and do not enable it for messages you dissect and retain pieces of. For the same reason it cannot be combined with `(vtproto.mempool)` on the same message — the generator will refuse. + + The bundled gRPC and DRPC codecs automatically prefer `UnmarshalVTSlab` when a message provides it, so opted-in messages get slab decoding without any call-site changes. + - `pool`: generates the following helper methods - `func (p *YourProto) ResetVT()`: this function behaves similarly to `proto.Reset(p)`, except it keeps as much memory as possible available on the message, so that further calls to `UnmarshalVT` on the same message will need to allocate less memory. This an API meant to be used with memory pools and does not need to be used directly. @@ -125,13 +131,26 @@ message Label { --go-vtproto_opt=pool=vitess.io/vitess/go/vt/proto/binlogdata.VStreamRowsResponse \ ``` -6. (Optional) If you are handling messages containing unknown fields and don't intend to forward these messages to a tool that might expect these fields, you can ignore them using the `ignoreUnknownFields` option. +6. (Optional) If you have enabled the `unmarshal_slab` feature, you need to specify which messages get the slab-allocated `UnmarshalVTSlab` entry point — read the trade-off note in the feature list above before opting a message in. + + - You can tag messages explicitly in the `.proto` files with `option (vtproto.slab)`: + + ```proto + message WriteBatch { + option (vtproto.slab) = true; // Enable slab-allocated unmarshalling + repeated Put puts = 1; + } + ``` + + - Alternatively, you can enumerate the objects with `--go-vtproto_opt=slab=.` (and exclude some again with `--go-vtproto_opt=slab-exclude=.`) flags passed via the CLI. Take a look at the example using `--go-vtproto_opt=pool=...` above. + +7. (Optional) If you are handling messages containing unknown fields and don't intend to forward these messages to a tool that might expect these fields, you can ignore them using the `ignoreUnknownFields` option. - You can tag messages explicitly in the `.proto` files with `option (vtproto.ignore_unknown_fields)`. Take a look at the example using `option (vtproto.mempool)` above. - Alternatively, you can enumerate the objects with `--go-vtproto_opt=ignoreUnknownFields=.` flags passed via the CLI. Take a look at the example using `--go-vtproto_opt=pool=...` above. -7. (Optional) if you want to selectively compile the generate `vtprotobuf` files, the `--vtproto_opt=buildTag=` can be used. +8. (Optional) if you want to selectively compile the generate `vtprotobuf` files, the `--vtproto_opt=buildTag=` can be used. When using this option, the generated code will only be compiled in if a build tag is provided. diff --git a/cmd/protoc-gen-go-vtproto/main.go b/cmd/protoc-gen-go-vtproto/main.go index e7a2ccf4..65a2ac3e 100644 --- a/cmd/protoc-gen-go-vtproto/main.go +++ b/cmd/protoc-gen-go-vtproto/main.go @@ -24,9 +24,13 @@ func main() { f.BoolVar(&cfg.AllowEmpty, "allow-empty", false, "allow generation of empty files") cfg.Poolable = generator.NewObjectSet() cfg.PoolableExclude = generator.NewObjectSet() + cfg.Slab = generator.NewObjectSet() + cfg.SlabExclude = generator.NewObjectSet() cfg.IgnoreUnknownFields = generator.NewObjectSet() f.Var(&cfg.Poolable, "pool", "use memory pooling for this object") f.Var(&cfg.PoolableExclude, "pool-exclude", "do not use memory pooling for this object") + f.Var(&cfg.Slab, "slab", "use slab-allocated unmarshalling for this object") + f.Var(&cfg.SlabExclude, "slab-exclude", "do not use slab-allocated unmarshalling for this object") f.Var(&cfg.IgnoreUnknownFields, "ignoreUnknownFields", "ignore unknown fields instead of saving them") f.BoolVar(&cfg.Wrap, "wrap", false, "generate wrapper types") f.StringVar(&features, "features", "all", "list of features to generate (separated by '+')") diff --git a/codec/drpc/drpc_codec.go b/codec/drpc/drpc_codec.go index 52e989a1..ac714c11 100644 --- a/codec/drpc/drpc_codec.go +++ b/codec/drpc/drpc_codec.go @@ -10,11 +10,21 @@ type vtprotoMessage interface { UnmarshalVT([]byte) error } +// vtprotoSlabMessage is implemented by messages that opted into slab +// unmarshalling (`option (vtproto.slab) = true;` with the unmarshal_slab +// feature); the codec prefers the slab entry point when it is available. +type vtprotoSlabMessage interface { + UnmarshalVTSlab([]byte) error +} + func Marshal(msg interface{}) ([]byte, error) { return msg.(vtprotoMessage).MarshalVT() } func Unmarshal(buf []byte, msg interface{}) error { + if m, ok := msg.(vtprotoSlabMessage); ok { + return m.UnmarshalVTSlab(buf) + } return msg.(vtprotoMessage).UnmarshalVT(buf) } diff --git a/codec/grpc/grpc_codec.go b/codec/grpc/grpc_codec.go index 9b72fcd9..e88f26ee 100644 --- a/codec/grpc/grpc_codec.go +++ b/codec/grpc/grpc_codec.go @@ -12,6 +12,14 @@ type vtprotoMessage interface { UnmarshalVT([]byte) error } +// vtprotoSlabMessage is implemented by messages that opted into slab +// unmarshalling (`option (vtproto.slab) = true;` with the unmarshal_slab +// feature): the codec prefers the slab entry point, so opted-in messages get +// arena-backed decoding without any call-site changes. +type vtprotoSlabMessage interface { + UnmarshalVTSlab([]byte) error +} + func (Codec) Marshal(v interface{}) ([]byte, error) { vt, ok := v.(vtprotoMessage) if !ok { @@ -21,6 +29,9 @@ func (Codec) Marshal(v interface{}) ([]byte, error) { } func (Codec) Unmarshal(data []byte, v interface{}) error { + if vt, ok := v.(vtprotoSlabMessage); ok { + return vt.UnmarshalVTSlab(data) + } vt, ok := v.(vtprotoMessage) if !ok { return fmt.Errorf("failed to unmarshal, message is %T (missing vtprotobuf helpers)", v) diff --git a/features/unmarshal/slab.go b/features/unmarshal/slab.go new file mode 100644 index 00000000..10ef7588 --- /dev/null +++ b/features/unmarshal/slab.go @@ -0,0 +1,396 @@ +// Copyright (c) 2021 PlanetScale Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package unmarshal + +import ( + "fmt" + "strconv" + "strings" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" + + "github.com/planetscale/vtprotobuf/generator" +) + +func init() { + generator.RegisterFeature("unmarshal_slab", func(gen *generator.GeneratedFile) generator.FeatureGenerator { + return &unmarshal{GeneratedFile: gen, slab: true} + }) +} + +// The unmarshal_slab feature emits, for every message that opts in with +// `option (vtproto.slab) = true;` (or a `slab=` plugin option), an +// UnmarshalVTSlab entry point that decodes exactly like UnmarshalVT but +// allocates nested message elements and scalar presence pointers from +// chunked slabs, so N element allocations collapse into O(log N) chunk +// allocations. A counting pre-pass over the top-level wire format reserves +// exactly-sized chunks for the repeated message fields before decoding, and +// payloads below protohelpers.SlabUnmarshalThreshold skip the arena and fall +// back to UnmarshalVT (for tiny messages the setup outweighs the savings). +// +// Slab elements are handed out once and never reused, so decoded messages +// behave like independently heap-allocated ones — except that retaining any +// pointer into the message graph pins that pointer's whole chunk. The entry +// point is therefore generated only for messages that explicitly opt in, and +// is meant for messages whose lifetime ends with the RPC that carried them. +// +// The transform covers the message graph reachable from an opted-in root +// through message-typed fields declared in the same .proto file; fields of +// types from other files, well-known types, and groups keep the stock +// decoding path (including unknown-field retention, which is preserved +// everywhere). + +// generateSlabFile drives the unmarshal_slab feature for one file: it +// computes the set of messages reachable from the opted-in roots, collects +// the slab element types they need into a per-file arena struct, and then +// reuses the stock unmarshal emission (with allocation sites redirected to +// the arena) to generate the arena-threaded decode methods. +func (p *unmarshal) generateSlabFile(file *protogen.File, proto3 bool) bool { + if p.Wrapper() { + return false + } + + var all []*protogen.Message + var collect func(messages []*protogen.Message) + collect = func(messages []*protogen.Message) { + for _, m := range messages { + if !m.Desc.IsMapEntry() { + all = append(all, m) + } + collect(m.Messages) + } + } + collect(file.Messages) + + var roots []*protogen.Message + for _, m := range all { + if p.ShouldSlab(m) { + if p.ShouldPool(m) { + panic(fmt.Sprintf("message %s enables both memory pooling and slab unmarshalling; the two cannot be combined", m.Desc.FullName())) + } + roots = append(roots, m) + } + } + if len(roots) == 0 { + return false + } + + p.slabFile = file + p.slabClosure = make(map[*protogen.Message]bool) + queue := append([]*protogen.Message(nil), roots...) + for _, m := range roots { + p.slabClosure[m] = true + } + for len(queue) > 0 { + m := queue[0] + queue = queue[1:] + for _, field := range m.Fields { + if target := p.slabFieldTarget(field); target != nil && !p.slabClosure[target] { + p.slabClosure[target] = true + queue = append(queue, target) + } + } + } + + // Register the arena slab fields in declaration order so the generated + // output is deterministic. + p.slabFieldByType = make(map[string]string) + p.slabFieldNames = make(map[string]bool) + for _, m := range all { + if !p.slabClosure[m] { + continue + } + for _, field := range m.Fields { + if target := p.slabFieldTarget(field); target != nil { + p.registerSlabField(target.GoIdent.GoName) + } + if typ, ok := p.pointerScalarType(proto3, field); ok { + p.registerSlabField(typ) + } + } + } + + p.slabArena = "slabArena_" + strings.TrimPrefix(file.GoDescriptorIdent.GoName, "File_") + + p.P(`// `, p.slabArena, ` holds the slabs backing the UnmarshalVTSlab entry`) + p.P(`// points of this file. One arena lives for the duration of a single`) + p.P(`// top-level unmarshal call.`) + p.P(`type `, p.slabArena, ` struct {`) + for _, typ := range p.slabFieldOrder { + p.P(p.slabFieldByType[typ], ` `, p.Helper("Slab"), `[`, typ, `]`) + } + p.P(`}`) + p.P() + + for _, message := range file.Messages { + p.message(proto3, message) + } + return p.once +} + +// slabFieldTarget returns the message type that unmarshalling this field +// allocates from a slab (the element type for repeated fields, the value +// type for maps, the field type otherwise), or nil if the field keeps the +// stock allocation path. Only message types declared in the same file +// participate: their arena-threaded decode methods are generated alongside +// the arena type itself, so the output stays self-contained. +func (p *unmarshal) slabFieldTarget(field *protogen.Field) *protogen.Message { + target := field.Message + if field.Desc.IsMap() { + vf := field.Message.Fields[1] + if vf.Desc.Kind() != protoreflect.MessageKind { + return nil + } + target = vf.Message + } else if field.Desc.Kind() != protoreflect.MessageKind { + return nil + } + if target.Desc.ParentFile().Path() != p.slabFile.Desc.Path() { + return nil + } + return target +} + +// pointerScalarType reports whether unmarshalling this field stores a +// pointer to a scalar (a proto2 or explicit-presence scalar, enum or string +// field), and returns the pointed-to Go type. These are the `m.F = &v` sites +// in the stock decoder that slab mode redirects to per-type slabs. +func (p *unmarshal) pointerScalarType(proto3 bool, field *protogen.Field) (string, bool) { + if field.Desc.IsMap() || field.Desc.IsList() { + return "", false + } + if field.Oneof != nil && !field.Oneof.Desc.IsSynthetic() { + return "", false + } + nullable := field.Oneof != nil && field.Oneof.Desc.IsSynthetic() + if proto3 && !nullable { + return "", false + } + switch field.Desc.Kind() { + case protoreflect.MessageKind, protoreflect.GroupKind, protoreflect.BytesKind: + return "", false + } + return p.noStarOrSliceType(field), true +} + +// registerSlabField assigns (or returns) the arena field name for a slab +// element type, keeping names unique even if two distinct type expressions +// sanitize to the same identifier. +func (p *unmarshal) registerSlabField(typ string) string { + if name, ok := p.slabFieldByType[typ]; ok { + return name + } + base := "f_" + sanitizeSlabIdent(typ) + name := base + for i := 2; p.slabFieldNames[name]; i++ { + name = base + strconv.Itoa(i) + } + p.slabFieldNames[name] = true + p.slabFieldByType[typ] = name + p.slabFieldOrder = append(p.slabFieldOrder, typ) + return name +} + +// slabField returns the arena field name registered for a slab element type. +func (p *unmarshal) slabField(typ string) string { + name, ok := p.slabFieldByType[typ] + if !ok { + panic(fmt.Sprintf("no slab arena field registered for type %q", typ)) + } + return name +} + +func sanitizeSlabIdent(typ string) string { + return strings.Map(func(r rune) rune { + switch { + case r >= 'a' && r <= 'z', r >= 'A' && r <= 'Z', r >= '0' && r <= '9', r == '_': + return r + } + return '_' + }, typ) +} + +// storePtrVar stores a pointer to the decoded scalar variable into the +// field: the stock decoder takes the address of the stack temporary, slab +// mode copies the value into a per-type slab instead. +func (p *unmarshal) storePtrVar(fieldname, typ, varName string) { + if p.slab { + p.P(`m.`, fieldname, ` = a.`, p.slabField(typ), `.NextValue(`, varName, `)`) + } else { + p.P(`m.`, fieldname, ` = &`, varName) + } +} + +// storePtrExpr is storePtrVar for sites where the stock decoder materializes +// the value through a named temporary (`tmpName := expr; m.F = &tmpName`). +func (p *unmarshal) storePtrExpr(fieldname, typ, tmpName, expr string) { + if p.slab { + p.P(`m.`, fieldname, ` = a.`, p.slabField(typ), `.NextValue(`, expr, `)`) + } else { + p.P(tmpName, ` := `, expr) + p.P(`m.`, fieldname, ` = &`, tmpName) + } +} + +// slabEntryPoint emits the public UnmarshalVTSlab method for an opted-in +// message: the small-payload bypass, the counting pre-pass over the +// top-level wire format, the slab reservations derived from those counts, +// and the call into the arena-threaded decoder. +func (p *unmarshal) slabEntryPoint(message *protogen.Message) { + ccTypeName := message.GoIdent.GoName + + // The counted fields: top-level repeated message fields and maps with + // message values, whose elements come from slabs. One linear scan + // counts them all so their slabs can be reserved exactly-sized. + type countedField struct { + number int32 + target *protogen.Message + } + var counted []countedField + for _, field := range message.Fields { + if !field.Desc.IsMap() && !field.Desc.IsList() { + continue + } + if target := p.slabFieldTarget(field); target != nil { + counted = append(counted, countedField{int32(field.Desc.Number()), target}) + } + } + + // Reservations: the counted types get their exact counts, and every type + // reachable through chains of plain singular message fields gets the + // originating count multiplied by how many instances one parent can hold + // (an upper bound: singular fields may be absent). The root's own + // singular chains contribute a constant. Anything else — nested repeated + // fields, oneof variants, scalar slabs — falls back to chunked growth. + type resRow struct { + constant int + coeff []int + } + rows := make(map[string]*resRow) + row := func(t *protogen.Message) *resRow { + name := t.GoIdent.GoName + r, ok := rows[name] + if !ok { + r = &resRow{coeff: make([]int, len(counted))} + rows[name] = r + } + return r + } + + memo := make(map[*protogen.Message]map[*protogen.Message]int) + for _, field := range message.Fields { + if target := p.singularFieldTarget(field); target != nil { + row(target).constant++ + for t, n := range p.singularReach(target, memo, map[*protogen.Message]bool{}) { + row(t).constant += n + } + } + } + for i, cf := range counted { + row(cf.target).coeff[i]++ + for t, n := range p.singularReach(cf.target, memo, map[*protogen.Message]bool{}) { + row(t).coeff[i] += n + } + } + + p.P(`// UnmarshalVTSlab is like UnmarshalVT, but allocates nested message`) + p.P(`// elements and scalar presence pointers from chunked slabs sized by a`) + p.P(`// counting pre-pass over the wire format. Retaining any pointer into`) + p.P(`// the decoded message pins that pointer's whole chunk in memory: use`) + p.P(`// it for messages whose lifetime ends with the RPC that carried them.`) + p.P(`func (m *`, ccTypeName, `) UnmarshalVTSlab(dAtA []byte) error {`) + p.P(`if len(dAtA) < `, p.Helper("SlabUnmarshalThreshold"), ` {`) + p.P(`return m.UnmarshalVT(dAtA)`) + p.P(`}`) + p.P(`var a `, p.slabArena) + if len(counted) > 0 { + k := strconv.Itoa(len(counted)) + nums := make([]string, len(counted)) + sum := make([]string, len(counted)) + for i, cf := range counted { + nums[i] = strconv.Itoa(int(cf.number)) + sum[i] = `counts[` + strconv.Itoa(i) + `]` + } + p.P(`fieldNums := [`, k, `]int32{`, strings.Join(nums, ", "), `}`) + p.P(`var counts [`, k, `]int`) + p.P(p.Helper("CountFields"), `(dAtA, fieldNums[:], counts[:])`) + p.P(`if `, strings.Join(sum, `+`), ` < `, p.Helper("SlabUnmarshalMinCount"), ` {`) + p.P(`return m.UnmarshalVT(dAtA)`) + p.P(`}`) + } + // Emit reservations in arena field registration order (declaration + // order): accumulation above ranges over maps, so any first-touch order + // would make the output nondeterministic across generator runs. + for _, typ := range p.slabFieldOrder { + r, ok := rows[typ] + if !ok { + continue + } + var terms []string + if r.constant > 0 { + terms = append(terms, strconv.Itoa(r.constant)) + } + for i, c := range r.coeff { + switch { + case c == 1: + terms = append(terms, `counts[`+strconv.Itoa(i)+`]`) + case c > 1: + terms = append(terms, strconv.Itoa(c)+`*counts[`+strconv.Itoa(i)+`]`) + } + } + p.P(`a.`, p.slabField(typ), `.Reserve(`, strings.Join(terms, ` + `), `)`) + } + p.P(`return m.unmarshalVTSlab(dAtA, &a)`) + p.P(`}`) + p.P() +} + +// singularFieldTarget returns the slab closure type of a plain singular +// message field (not repeated, not a map, not a member of a real oneof — at +// most one oneof variant is set, so reserving for all of them would +// systematically over-allocate), or nil. +func (p *unmarshal) singularFieldTarget(field *protogen.Field) *protogen.Message { + if field.Desc.IsMap() || field.Desc.IsList() { + return nil + } + if field.Oneof != nil && !field.Oneof.Desc.IsSynthetic() { + return nil + } + if field.Desc.Kind() != protoreflect.MessageKind { + return nil + } + return p.slabFieldTarget(field) +} + +// singularReach returns, for every slab closure type, how many instances a +// single instance of m can allocate through chains of plain singular message +// fields — the multiplier used to turn a parent count into a reservation +// upper bound. Results are memoized per file; recursion cycles are cut by +// treating the back edge as zero (an under-estimate, which merely falls back +// to chunked growth). +func (p *unmarshal) singularReach(m *protogen.Message, memo map[*protogen.Message]map[*protogen.Message]int, inProgress map[*protogen.Message]bool) map[*protogen.Message]int { + if r, ok := memo[m]; ok { + return r + } + if inProgress[m] { + return nil + } + inProgress[m] = true + r := make(map[*protogen.Message]int) + for _, field := range m.Fields { + target := p.singularFieldTarget(field) + if target == nil { + continue + } + r[target]++ + for t, n := range p.singularReach(target, memo, inProgress) { + r[t] += n + } + } + delete(inProgress, m) + memo[m] = r + return r +} diff --git a/features/unmarshal/unmarshal.go b/features/unmarshal/unmarshal.go index c5540a51..672d5190 100644 --- a/features/unmarshal/unmarshal.go +++ b/features/unmarshal/unmarshal.go @@ -32,13 +32,25 @@ func init() { type unmarshal struct { *generator.GeneratedFile unsafe bool + slab bool once bool + + // slab-mode state, computed per file by generateSlabFile + slabFile *protogen.File + slabArena string + slabClosure map[*protogen.Message]bool + slabFieldByType map[string]string + slabFieldNames map[string]bool + slabFieldOrder []string } var _ generator.FeatureGenerator = (*unmarshal)(nil) func (p *unmarshal) GenerateFile(file *protogen.File) bool { proto3 := file.Desc.Syntax() == protoreflect.Proto3 + if p.slab { + return p.generateSlabFile(file, proto3) + } for _, message := range file.Messages { p.message(proto3, message) } @@ -54,6 +66,12 @@ func (p *unmarshal) methodUnmarshal() string { } func (p *unmarshal) decodeMessage(varName, buf string, message *protogen.Message) { + if p.slab && p.slabClosure[message] { + p.P(`if err := `, varName, `.unmarshalVTSlab(`, buf, `, a); err != nil {`) + p.P(`return err`) + p.P(`}`) + return + } switch { case p.IsWellKnownType(message): p.P(`if err := (*`, p.WellKnownTypeMap(message), `)(`, varName, `).`, p.methodUnmarshal(), `(`, buf, `); err != nil {`) @@ -226,7 +244,11 @@ func (p *unmarshal) mapField(varName string, field *protogen.Field, unique bool) p.P(`return `, p.Ident("io", `ErrUnexpectedEOF`)) p.P(`}`) buf := `dAtA[iNdEx:postmsgIndex]` - p.P(varName, ` = &`, p.noStarOrSliceType(field), `{}`) + if p.slab && p.slabClosure[field.Message] { + p.P(varName, ` = a.`, p.slabField(field.Message.GoIdent.GoName), `.Next()`) + } else { + p.P(varName, ` = &`, p.noStarOrSliceType(field), `{}`) + } p.decodeMessage(varName, buf, field.Message) p.P(`iNdEx = postmsgIndex`) case protoreflect.BytesKind: @@ -301,8 +323,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else if proto3 && !nullable { p.P(`m.`, fieldname, ` = `, typ, "(", p.Ident("math", "Float64frombits"), `(v))`) } else { - p.P(`v2 := `, typ, "(", p.Ident("math", "Float64frombits"), `(v))`) - p.P(`m.`, fieldname, ` = &v2`) + p.storePtrExpr(fieldname, typ, "v2", typ+"("+p.Ident("math", "Float64frombits")+"(v))") } case protoreflect.FloatKind: p.P(`var v uint32`) @@ -315,8 +336,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else if proto3 && !nullable { p.P(`m.`, fieldname, ` = `, typ, "(", p.Ident("math", "Float32frombits"), `(v))`) } else { - p.P(`v2 := `, typ, "(", p.Ident("math", "Float32frombits"), `(v))`) - p.P(`m.`, fieldname, ` = &v2`) + p.storePtrExpr(fieldname, typ, "v2", typ+"("+p.Ident("math", "Float32frombits")+"(v))") } case protoreflect.Int64Kind: if oneof { @@ -333,7 +353,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Uint64Kind: if oneof { @@ -350,7 +370,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Int32Kind: if oneof { @@ -367,7 +387,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Fixed64Kind: if oneof { @@ -384,7 +404,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Fixed32Kind: if oneof { @@ -401,7 +421,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.BoolKind: p.P(`var v int`) @@ -414,8 +434,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else if proto3 && !nullable { p.P(`m.`, fieldname, ` = `, typ, `(v != 0)`) } else { - p.P(`b := `, typ, `(v != 0)`) - p.P(`m.`, fieldname, ` = &b`) + p.storePtrExpr(fieldname, typ, "b", typ+`(v != 0)`) } case protoreflect.StringKind: unique := proto.GetExtension(field.Desc.Options(), vtproto.E_Options).(*vtproto.Opts).GetUnique() @@ -455,8 +474,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else if proto3 && !nullable { p.P(`m.`, fieldname, ` = `, str) } else { - p.P(`s := `, str) - p.P(`m.`, fieldname, ` = &s`) + p.storePtrExpr(fieldname, typ, "s", str) } p.P(`iNdEx = postIndex`) case protoreflect.GroupKind: @@ -498,7 +516,9 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`if oneof, ok := m.`, fieldname, `.(*`, field.GoIdent, `); ok {`) p.decodeMessage("oneof."+field.GoName, buf, field.Message) p.P(`} else {`) - if p.ShouldPool(message) && p.ShouldPool(field.Message) { + if p.slab && p.slabClosure[field.Message] { + p.P(`v := a.`, p.slabField(field.Message.GoIdent.GoName), `.Next()`) + } else if p.ShouldPool(message) && p.ShouldPool(field.Message) { p.P(`v := `, msgname, `FromVTPool()`) } else { p.P(`v := &`, msgname, `{}`) @@ -547,7 +567,9 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.P(`}`) p.P(`m.`, fieldname, `[mapkey] = mapvalue`) } else if repeated { - if p.ShouldPool(message) { + if p.slab && p.slabClosure[field.Message] { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, a.`, p.slabField(field.Message.GoIdent.GoName), `.Next())`) + } else if p.ShouldPool(message) { p.P(`if len(m.`, fieldname, `) == cap(m.`, fieldname, `) {`) p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, field.Message.GoIdent, `{})`) p.P(`} else {`) @@ -564,7 +586,9 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * p.decodeMessage(varname, buf, field.Message) } else { p.P(`if m.`, fieldname, ` == nil {`) - if p.ShouldPool(message) && p.ShouldPool(field.Message) { + if p.slab && p.slabClosure[field.Message] { + p.P(`m.`, fieldname, ` = a.`, p.slabField(field.Message.GoIdent.GoName), `.Next()`) + } else if p.ShouldPool(message) && p.ShouldPool(field.Message) { p.P(`m.`, fieldname, ` = `, field.Message.GoIdent, `FromVTPool()`) } else { p.P(`m.`, fieldname, ` = &`, field.Message.GoIdent, `{}`) @@ -628,7 +652,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.EnumKind: if oneof { @@ -645,7 +669,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Sfixed32Kind: if oneof { @@ -662,7 +686,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Sfixed64Kind: if oneof { @@ -679,7 +703,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else { p.P(`var v `, typ) p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Sint32Kind: p.P(`var v `, typ) @@ -692,7 +716,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else if proto3 && !nullable { p.P(`m.`, fieldname, ` = v`) } else { - p.P(`m.`, fieldname, ` = &v`) + p.storePtrVar(fieldname, typ, "v") } case protoreflect.Sint64Kind: p.P(`var v uint64`) @@ -705,8 +729,7 @@ func (p *unmarshal) fieldItem(field *protogen.Field, fieldname string, message * } else if proto3 && !nullable { p.P(`m.`, fieldname, ` = `, typ, `(v)`) } else { - p.P(`v2 := `, typ, `(v)`) - p.P(`m.`, fieldname, ` = &v2`) + p.storePtrExpr(fieldname, typ, "v2", typ+`(v)`) } default: panic("not implemented") @@ -802,12 +825,22 @@ func (p *unmarshal) message(proto3 bool, message *protogen.Message) { if message.Desc.IsMapEntry() { return } + if p.slab && !p.slabClosure[message] { + return + } p.once = true ccTypeName := message.GoIdent.GoName required := message.Desc.RequiredNumbers() - p.P(`func (m *`, ccTypeName, `) `, p.methodUnmarshal(), `(dAtA []byte) error {`) + if p.slab { + if p.ShouldSlab(message) { + p.slabEntryPoint(message) + } + p.P(`func (m *`, ccTypeName, `) unmarshalVTSlab(dAtA []byte, a *`, p.slabArena, `) error {`) + } else { + p.P(`func (m *`, ccTypeName, `) `, p.methodUnmarshal(), `(dAtA []byte) error {`) + } if required.Len() > 0 { p.P(`var hasFields [`, strconv.Itoa(1+(required.Len()-1)/64), `]uint64`) } diff --git a/generator/generatedfile.go b/generator/generatedfile.go index 07c3d920..12a0bfd1 100644 --- a/generator/generatedfile.go +++ b/generator/generatedfile.go @@ -41,6 +41,23 @@ func (b *GeneratedFile) ShouldPool(message *protogen.Message) bool { return false } +func (b *GeneratedFile) ShouldSlab(message *protogen.Message) bool { + // Do not generate slab unmarshalling if message is nil or message excluded by external rules + if message == nil || b.Config.SlabExclude.Contains(message.GoIdent) { + return false + } + + if b.Config.Slab.Contains(message.GoIdent) { + return true + } + + ext := proto.GetExtension(message.Desc.Options(), vtproto.E_Slab) + if slab, ok := ext.(bool); ok { + return slab + } + return false +} + func (b *GeneratedFile) ShouldIgnoreUnknownFields(message *protogen.Message) bool { if b.Config.IgnoreUnknownFields.Contains(message.GoIdent) { return true @@ -133,6 +150,10 @@ var helpers = map[string]protogen.GoIdent{ "ErrInvalidLength": {GoName: "ErrInvalidLength", GoImportPath: vtHelpersPackage}, "ErrIntOverflow": {GoName: "ErrIntOverflow", GoImportPath: vtHelpersPackage}, "ErrUnexpectedEndOfGroup": {GoName: "ErrUnexpectedEndOfGroup", GoImportPath: vtHelpersPackage}, + "Slab": {GoName: "Slab", GoImportPath: vtHelpersPackage}, + "CountFields": {GoName: "CountFields", GoImportPath: vtHelpersPackage}, + "SlabUnmarshalThreshold": {GoName: "SlabUnmarshalThreshold", GoImportPath: vtHelpersPackage}, + "SlabUnmarshalMinCount": {GoName: "SlabUnmarshalMinCount", GoImportPath: vtHelpersPackage}, } func (p *GeneratedFile) Helper(name string) protogen.GoIdent { diff --git a/generator/generator.go b/generator/generator.go index a575ed45..b729b0db 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -56,6 +56,10 @@ type Config struct { Poolable ObjectSet // PoolableExclude rules determines if pool feature disabled for particular message PoolableExclude ObjectSet + // Slab rules determines if the unmarshal_slab feature generates for particular message + Slab ObjectSet + // SlabExclude rules determines if the unmarshal_slab feature is disabled for particular message + SlabExclude ObjectSet // IgnoreUnknownFields contains messages for which unknown fields shall be ignored IgnoreUnknownFields ObjectSet Wrap bool diff --git a/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto b/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto index 21d78109..24025f05 100644 --- a/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto +++ b/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto @@ -10,6 +10,7 @@ option go_package = "github.com/planetscale/vtprotobuf/vtproto"; extend google.protobuf.MessageOptions { optional bool mempool = 64101; optional bool ignore_unknown_fields = 64102; + optional bool slab = 64103; } extend google.protobuf.FieldOptions { diff --git a/protohelpers/slab.go b/protohelpers/slab.go new file mode 100644 index 00000000..e5c5ad52 --- /dev/null +++ b/protohelpers/slab.go @@ -0,0 +1,130 @@ +package protohelpers + +// SlabUnmarshalThreshold is the payload size (in bytes) below which the +// generated UnmarshalVTSlab methods fall back to plain UnmarshalVT: for tiny +// messages the arena setup and counting pre-pass cost more than the handful +// of allocations they would save. +const SlabUnmarshalThreshold = 256 + +// SlabUnmarshalMinCount is the minimum number of counted repeated-message +// elements the pre-pass must find for the generated UnmarshalVTSlab methods +// to use the arena; below it they fall back to plain UnmarshalVT. Slabs win +// by amortizing many same-type allocations into shared chunks, so a payload +// that carries only a couple of elements — however large its byte size — +// would pay the per-type chunk minimums without the amortization. +const SlabUnmarshalMinCount = 4 + +// Slab hands out zeroed *T elements carved from chunked backing arrays, so N +// element allocations collapse into O(log N) chunk allocations. Elements are +// handed out exactly once and never reused, so pointers into a chunk stay +// valid forever; a retained pointer pins its whole chunk, which is the +// intended trade-off for RPC-lifetime messages. +type Slab[T any] struct { + chunk []T + // grow is the size of the next growth chunk. It intentionally does not + // account for Reserve: when a reservation is undershot, growth restarts + // small instead of doubling the (possibly large) reserved chunk, so an + // overflow of a few elements never allocates reservation-sized chunks. + grow int +} + +// Next returns a pointer to a new zeroed element. +func (s *Slab[T]) Next() *T { + if len(s.chunk) == cap(s.chunk) { + n := s.grow + switch { + case n == 0: + n = 8 + case n > 1024: + n = 1024 + } + s.chunk = make([]T, 0, n) + s.grow = n * 2 + } + s.chunk = s.chunk[:len(s.chunk)+1] + return &s.chunk[len(s.chunk)-1] +} + +// NextValue returns a pointer to a new element initialized to v. +func (s *Slab[T]) NextValue(v T) *T { + p := s.Next() + *p = v + return p +} + +// Reserve pre-sizes an empty slab so that the next n calls to Next land in +// one exactly-sized chunk. It has no effect once the slab has a chunk, and a +// reservation that turns out too small simply falls back to chunked growth, +// so callers may pass a best-effort estimate. +func (s *Slab[T]) Reserve(n int) { + if s.chunk == nil && n > 0 { + s.chunk = make([]T, 0, n) + } +} + +// CountFields performs one linear pass over the top-level records of a +// serialized message and increments counts[i] for every length-delimited +// occurrence of field number fieldNums[i]. fieldNums and counts must have the +// same length. The counts are used to Reserve exactly-sized slabs before +// decoding; on malformed input (or on encountering a group, which would +// require nested tracking) it returns early with the counts gathered so far, +// which at worst under-reserves and falls back to chunked growth. +func CountFields(data []byte, fieldNums []int32, counts []int) { + l := len(data) + i := 0 + for i < l { + key, n := countVarint(data, i) + if n < 0 { + return + } + i = n + switch key & 0x7 { + case 0: // varint + _, n = countVarint(data, i) + if n < 0 { + return + } + i = n + case 1: // fixed64 + i += 8 + case 2: // length-delimited + length, n := countVarint(data, i) + if n < 0 { + return + } + i = n + fieldNum := int32(key >> 3) + for j, want := range fieldNums { + if want == fieldNum { + counts[j]++ + break + } + } + i += int(length) + if i < 0 { + return + } + case 5: // fixed32 + i += 4 + default: // groups or invalid wire type + return + } + } +} + +// countVarint decodes a varint at data[i:] and returns its value and the +// offset of the next byte, or a negative offset on truncated input. +func countVarint(data []byte, i int) (v uint64, next int) { + for shift := uint(0); shift < 64; shift += 7 { + if i >= len(data) { + return 0, -1 + } + b := data[i] + i++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + return v, i + } + } + return 0, -1 +} diff --git a/protohelpers/slab_test.go b/protohelpers/slab_test.go new file mode 100644 index 00000000..f58509d6 --- /dev/null +++ b/protohelpers/slab_test.go @@ -0,0 +1,154 @@ +package protohelpers + +import ( + "testing" + + "google.golang.org/protobuf/encoding/protowire" +) + +func TestSlabNextHandsOutDistinctZeroedElements(t *testing.T) { + var s Slab[int64] + seen := make(map[*int64]bool) + for i := 0; i < 3000; i++ { + p := s.Next() + if *p != 0 { + t.Fatalf("element %d not zeroed: %d", i, *p) + } + if seen[p] { + t.Fatalf("element %d handed out twice", i) + } + seen[p] = true + *p = int64(i) + } + if len(seen) != 3000 { + t.Fatalf("expected 3000 distinct elements, got %d", len(seen)) + } +} + +func TestSlabNextValue(t *testing.T) { + var s Slab[string] + p := s.NextValue("hello") + if *p != "hello" { + t.Fatalf("NextValue stored %q", *p) + } + q := s.NextValue("world") + if *p != "hello" || *q != "world" { + t.Fatalf("NextValue overwrote a previous element: %q %q", *p, *q) + } +} + +func TestSlabReserveExact(t *testing.T) { + allocs := testing.AllocsPerRun(100, func() { + var s Slab[uint64] + s.Reserve(100) + for i := 0; i < 100; i++ { + *s.Next() = uint64(i) + } + }) + if allocs != 1 { + t.Fatalf("expected exactly 1 chunk allocation for a reserved slab, got %v", allocs) + } +} + +func TestSlabReserveUndershootFallsBackToGrowth(t *testing.T) { + var s Slab[int32] + s.Reserve(4) + seen := make(map[*int32]bool) + for i := 0; i < 100; i++ { + p := s.Next() + if seen[p] { + t.Fatal("element handed out twice after reservation undershoot") + } + seen[p] = true + } +} + +func TestSlabReserveAfterUseIsNoop(t *testing.T) { + var s Slab[int32] + p := s.Next() + *p = 42 + s.Reserve(1000) + if *p != 42 { + t.Fatal("Reserve after use disturbed an existing element") + } +} + +func TestCountFields(t *testing.T) { + var data []byte + data = protowire.AppendTag(data, 1, protowire.VarintType) + data = protowire.AppendVarint(data, 300) + data = protowire.AppendTag(data, 2, protowire.BytesType) + data = protowire.AppendBytes(data, []byte("abc")) + data = protowire.AppendTag(data, 3, protowire.Fixed64Type) + data = protowire.AppendFixed64(data, 7) + data = protowire.AppendTag(data, 2, protowire.BytesType) + data = protowire.AppendBytes(data, []byte("def")) + data = protowire.AppendTag(data, 4, protowire.Fixed32Type) + data = protowire.AppendFixed32(data, 7) + data = protowire.AppendTag(data, 5, protowire.BytesType) + // a nested message containing field 2 must NOT be counted: the scan is + // top-level only + nested := protowire.AppendTag(nil, 2, protowire.BytesType) + nested = protowire.AppendBytes(nested, []byte("inner")) + data = protowire.AppendBytes(data, nested) + data = protowire.AppendTag(data, 5, protowire.BytesType) + data = protowire.AppendBytes(data, nil) + + fieldNums := []int32{2, 5, 9} + counts := make([]int, 3) + CountFields(data, fieldNums, counts) + if counts[0] != 2 || counts[1] != 2 || counts[2] != 0 { + t.Fatalf("got counts %v, want [2 2 0]", counts) + } + + // varint field 2 must not be counted (only length-delimited occurrences) + data2 := protowire.AppendTag(nil, 2, protowire.VarintType) + data2 = protowire.AppendVarint(data2, 1) + counts2 := make([]int, 1) + CountFields(data2, []int32{2}, counts2) + if counts2[0] != 0 { + t.Fatalf("varint occurrence counted: %v", counts2) + } +} + +func TestCountFieldsStopsAtGroups(t *testing.T) { + var data []byte + data = protowire.AppendTag(data, 2, protowire.BytesType) + data = protowire.AppendBytes(data, []byte("abc")) + data = protowire.AppendTag(data, 3, protowire.StartGroupType) + data = protowire.AppendTag(data, 2, protowire.BytesType) // inside the group + data = protowire.AppendBytes(data, []byte("x")) + data = protowire.AppendTag(data, 3, protowire.EndGroupType) + data = protowire.AppendTag(data, 2, protowire.BytesType) // after the group + data = protowire.AppendBytes(data, []byte("def")) + + counts := make([]int, 1) + CountFields(data, []int32{2}, counts) + // the scan bails at the group: only the occurrence before it is counted + if counts[0] != 1 { + t.Fatalf("got count %d, want 1 (scan should stop at the group)", counts[0]) + } +} + +func TestCountFieldsMalformedInput(t *testing.T) { + var data []byte + data = protowire.AppendTag(data, 2, protowire.BytesType) + data = protowire.AppendBytes(data, []byte("abcdef")) + data = protowire.AppendTag(data, 2, protowire.BytesType) + data = protowire.AppendBytes(data, []byte("ghijkl")) + + // truncations at every offset must never panic and never overcount + for i := 0; i <= len(data); i++ { + counts := make([]int, 1) + CountFields(data[:i], []int32{2}, counts) + if counts[0] > 2 { + t.Fatalf("truncation at %d overcounted: %d", i, counts[0]) + } + } + + // a length prefix pointing far past the buffer must not panic + bad := protowire.AppendTag(nil, 2, protowire.BytesType) + bad = protowire.AppendVarint(bad, 1<<40) + counts := make([]int, 1) + CountFields(bad, []int32{2}, counts) +} diff --git a/testproto/slab/nested.pb.go b/testproto/slab/nested.pb.go new file mode 100644 index 00000000..b0e3fa24 --- /dev/null +++ b/testproto/slab/nested.pb.go @@ -0,0 +1,994 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v3.21.12 +// source: slab/nested.proto + +package slab + +import ( + _ "github.com/planetscale/vtprotobuf/vtproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type NestedOrder struct { + state protoimpl.MessageState `protogen:"open.v1"` + OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + Sequence *int64 `protobuf:"varint,2,opt,name=sequence,proto3,oneof" json:"sequence,omitempty"` + Customer *NestedParty `protobuf:"bytes,3,opt,name=customer,proto3" json:"customer,omitempty"` + Lines []*NestedLine `protobuf:"bytes,4,rep,name=lines,proto3" json:"lines,omitempty"` + Notes map[string]*NestedNote `protobuf:"bytes,5,rep,name=notes,proto3" json:"notes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Totals *NestedTotals `protobuf:"bytes,6,opt,name=totals,proto3" json:"totals,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedOrder) Reset() { + *x = NestedOrder{} + mi := &file_slab_nested_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedOrder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedOrder) ProtoMessage() {} + +func (x *NestedOrder) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedOrder.ProtoReflect.Descriptor instead. +func (*NestedOrder) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{0} +} + +func (x *NestedOrder) GetOrderId() string { + if x != nil { + return x.OrderId + } + return "" +} + +func (x *NestedOrder) GetSequence() int64 { + if x != nil && x.Sequence != nil { + return *x.Sequence + } + return 0 +} + +func (x *NestedOrder) GetCustomer() *NestedParty { + if x != nil { + return x.Customer + } + return nil +} + +func (x *NestedOrder) GetLines() []*NestedLine { + if x != nil { + return x.Lines + } + return nil +} + +func (x *NestedOrder) GetNotes() map[string]*NestedNote { + if x != nil { + return x.Notes + } + return nil +} + +func (x *NestedOrder) GetTotals() *NestedTotals { + if x != nil { + return x.Totals + } + return nil +} + +type NestedParty struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + TaxId *string `protobuf:"bytes,2,opt,name=tax_id,json=taxId,proto3,oneof" json:"tax_id,omitempty"` + Billing *NestedAddress `protobuf:"bytes,3,opt,name=billing,proto3" json:"billing,omitempty"` + Delivery *NestedAddress `protobuf:"bytes,4,opt,name=delivery,proto3" json:"delivery,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedParty) Reset() { + *x = NestedParty{} + mi := &file_slab_nested_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedParty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedParty) ProtoMessage() {} + +func (x *NestedParty) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedParty.ProtoReflect.Descriptor instead. +func (*NestedParty) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{1} +} + +func (x *NestedParty) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NestedParty) GetTaxId() string { + if x != nil && x.TaxId != nil { + return *x.TaxId + } + return "" +} + +func (x *NestedParty) GetBilling() *NestedAddress { + if x != nil { + return x.Billing + } + return nil +} + +func (x *NestedParty) GetDelivery() *NestedAddress { + if x != nil { + return x.Delivery + } + return nil +} + +type NestedAddress struct { + state protoimpl.MessageState `protogen:"open.v1"` + Street string `protobuf:"bytes,1,opt,name=street,proto3" json:"street,omitempty"` + City string `protobuf:"bytes,2,opt,name=city,proto3" json:"city,omitempty"` + Region *string `protobuf:"bytes,3,opt,name=region,proto3,oneof" json:"region,omitempty"` + Zip *uint32 `protobuf:"varint,4,opt,name=zip,proto3,oneof" json:"zip,omitempty"` + Geo *NestedGeo `protobuf:"bytes,5,opt,name=geo,proto3" json:"geo,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedAddress) Reset() { + *x = NestedAddress{} + mi := &file_slab_nested_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedAddress) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedAddress) ProtoMessage() {} + +func (x *NestedAddress) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedAddress.ProtoReflect.Descriptor instead. +func (*NestedAddress) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{2} +} + +func (x *NestedAddress) GetStreet() string { + if x != nil { + return x.Street + } + return "" +} + +func (x *NestedAddress) GetCity() string { + if x != nil { + return x.City + } + return "" +} + +func (x *NestedAddress) GetRegion() string { + if x != nil && x.Region != nil { + return *x.Region + } + return "" +} + +func (x *NestedAddress) GetZip() uint32 { + if x != nil && x.Zip != nil { + return *x.Zip + } + return 0 +} + +func (x *NestedAddress) GetGeo() *NestedGeo { + if x != nil { + return x.Geo + } + return nil +} + +type NestedGeo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Lat float64 `protobuf:"fixed64,1,opt,name=lat,proto3" json:"lat,omitempty"` + Lon float64 `protobuf:"fixed64,2,opt,name=lon,proto3" json:"lon,omitempty"` + Accuracy *float32 `protobuf:"fixed32,3,opt,name=accuracy,proto3,oneof" json:"accuracy,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedGeo) Reset() { + *x = NestedGeo{} + mi := &file_slab_nested_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedGeo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedGeo) ProtoMessage() {} + +func (x *NestedGeo) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedGeo.ProtoReflect.Descriptor instead. +func (*NestedGeo) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{3} +} + +func (x *NestedGeo) GetLat() float64 { + if x != nil { + return x.Lat + } + return 0 +} + +func (x *NestedGeo) GetLon() float64 { + if x != nil { + return x.Lon + } + return 0 +} + +func (x *NestedGeo) GetAccuracy() float32 { + if x != nil && x.Accuracy != nil { + return *x.Accuracy + } + return 0 +} + +type NestedLine struct { + state protoimpl.MessageState `protogen:"open.v1"` + Sku string `protobuf:"bytes,1,opt,name=sku,proto3" json:"sku,omitempty"` + Quantity *int64 `protobuf:"varint,2,opt,name=quantity,proto3,oneof" json:"quantity,omitempty"` + UnitPrice *float64 `protobuf:"fixed64,3,opt,name=unit_price,json=unitPrice,proto3,oneof" json:"unit_price,omitempty"` + Product *NestedProduct `protobuf:"bytes,4,opt,name=product,proto3" json:"product,omitempty"` + Discounts []*NestedDiscount `protobuf:"bytes,5,rep,name=discounts,proto3" json:"discounts,omitempty"` + // Types that are valid to be assigned to Fulfillment: + // + // *NestedLine_Ship + // *NestedLine_PickupLocation + Fulfillment isNestedLine_Fulfillment `protobuf_oneof:"fulfillment"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedLine) Reset() { + *x = NestedLine{} + mi := &file_slab_nested_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedLine) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedLine) ProtoMessage() {} + +func (x *NestedLine) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedLine.ProtoReflect.Descriptor instead. +func (*NestedLine) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{4} +} + +func (x *NestedLine) GetSku() string { + if x != nil { + return x.Sku + } + return "" +} + +func (x *NestedLine) GetQuantity() int64 { + if x != nil && x.Quantity != nil { + return *x.Quantity + } + return 0 +} + +func (x *NestedLine) GetUnitPrice() float64 { + if x != nil && x.UnitPrice != nil { + return *x.UnitPrice + } + return 0 +} + +func (x *NestedLine) GetProduct() *NestedProduct { + if x != nil { + return x.Product + } + return nil +} + +func (x *NestedLine) GetDiscounts() []*NestedDiscount { + if x != nil { + return x.Discounts + } + return nil +} + +func (x *NestedLine) GetFulfillment() isNestedLine_Fulfillment { + if x != nil { + return x.Fulfillment + } + return nil +} + +func (x *NestedLine) GetShip() *NestedShipment { + if x != nil { + if x, ok := x.Fulfillment.(*NestedLine_Ship); ok { + return x.Ship + } + } + return nil +} + +func (x *NestedLine) GetPickupLocation() string { + if x != nil { + if x, ok := x.Fulfillment.(*NestedLine_PickupLocation); ok { + return x.PickupLocation + } + } + return "" +} + +type isNestedLine_Fulfillment interface { + isNestedLine_Fulfillment() +} + +type NestedLine_Ship struct { + Ship *NestedShipment `protobuf:"bytes,6,opt,name=ship,proto3,oneof"` +} + +type NestedLine_PickupLocation struct { + PickupLocation string `protobuf:"bytes,7,opt,name=pickup_location,json=pickupLocation,proto3,oneof"` +} + +func (*NestedLine_Ship) isNestedLine_Fulfillment() {} + +func (*NestedLine_PickupLocation) isNestedLine_Fulfillment() {} + +type NestedProduct struct { + state protoimpl.MessageState `protogen:"open.v1"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Thumbnail []byte `protobuf:"bytes,2,opt,name=thumbnail,proto3" json:"thumbnail,omitempty"` + Attributes map[string]string `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Dims *NestedDimensions `protobuf:"bytes,4,opt,name=dims,proto3" json:"dims,omitempty"` + Brand *string `protobuf:"bytes,5,opt,name=brand,proto3,oneof" json:"brand,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedProduct) Reset() { + *x = NestedProduct{} + mi := &file_slab_nested_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedProduct) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedProduct) ProtoMessage() {} + +func (x *NestedProduct) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedProduct.ProtoReflect.Descriptor instead. +func (*NestedProduct) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{5} +} + +func (x *NestedProduct) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *NestedProduct) GetThumbnail() []byte { + if x != nil { + return x.Thumbnail + } + return nil +} + +func (x *NestedProduct) GetAttributes() map[string]string { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *NestedProduct) GetDims() *NestedDimensions { + if x != nil { + return x.Dims + } + return nil +} + +func (x *NestedProduct) GetBrand() string { + if x != nil && x.Brand != nil { + return *x.Brand + } + return "" +} + +type NestedDimensions struct { + state protoimpl.MessageState `protogen:"open.v1"` + Width *float64 `protobuf:"fixed64,1,opt,name=width,proto3,oneof" json:"width,omitempty"` + Height *float64 `protobuf:"fixed64,2,opt,name=height,proto3,oneof" json:"height,omitempty"` + Depth *float64 `protobuf:"fixed64,3,opt,name=depth,proto3,oneof" json:"depth,omitempty"` + WeightMg *uint64 `protobuf:"varint,4,opt,name=weight_mg,json=weightMg,proto3,oneof" json:"weight_mg,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedDimensions) Reset() { + *x = NestedDimensions{} + mi := &file_slab_nested_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedDimensions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedDimensions) ProtoMessage() {} + +func (x *NestedDimensions) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedDimensions.ProtoReflect.Descriptor instead. +func (*NestedDimensions) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{6} +} + +func (x *NestedDimensions) GetWidth() float64 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *NestedDimensions) GetHeight() float64 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *NestedDimensions) GetDepth() float64 { + if x != nil && x.Depth != nil { + return *x.Depth + } + return 0 +} + +func (x *NestedDimensions) GetWeightMg() uint64 { + if x != nil && x.WeightMg != nil { + return *x.WeightMg + } + return 0 +} + +type NestedDiscount struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + AmountMicros *int64 `protobuf:"zigzag64,2,opt,name=amount_micros,json=amountMicros,proto3,oneof" json:"amount_micros,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedDiscount) Reset() { + *x = NestedDiscount{} + mi := &file_slab_nested_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedDiscount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedDiscount) ProtoMessage() {} + +func (x *NestedDiscount) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedDiscount.ProtoReflect.Descriptor instead. +func (*NestedDiscount) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{7} +} + +func (x *NestedDiscount) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *NestedDiscount) GetAmountMicros() int64 { + if x != nil && x.AmountMicros != nil { + return *x.AmountMicros + } + return 0 +} + +type NestedShipment struct { + state protoimpl.MessageState `protogen:"open.v1"` + Carrier string `protobuf:"bytes,1,opt,name=carrier,proto3" json:"carrier,omitempty"` + Destination *NestedAddress `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"` + EtaUnix *uint64 `protobuf:"fixed64,3,opt,name=eta_unix,json=etaUnix,proto3,oneof" json:"eta_unix,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedShipment) Reset() { + *x = NestedShipment{} + mi := &file_slab_nested_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedShipment) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedShipment) ProtoMessage() {} + +func (x *NestedShipment) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedShipment.ProtoReflect.Descriptor instead. +func (*NestedShipment) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{8} +} + +func (x *NestedShipment) GetCarrier() string { + if x != nil { + return x.Carrier + } + return "" +} + +func (x *NestedShipment) GetDestination() *NestedAddress { + if x != nil { + return x.Destination + } + return nil +} + +func (x *NestedShipment) GetEtaUnix() uint64 { + if x != nil && x.EtaUnix != nil { + return *x.EtaUnix + } + return 0 +} + +type NestedNote struct { + state protoimpl.MessageState `protogen:"open.v1"` + Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` + Timestamp *int64 `protobuf:"varint,3,opt,name=timestamp,proto3,oneof" json:"timestamp,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedNote) Reset() { + *x = NestedNote{} + mi := &file_slab_nested_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedNote) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedNote) ProtoMessage() {} + +func (x *NestedNote) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedNote.ProtoReflect.Descriptor instead. +func (*NestedNote) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{9} +} + +func (x *NestedNote) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +func (x *NestedNote) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *NestedNote) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type NestedTotals struct { + state protoimpl.MessageState `protogen:"open.v1"` + SubtotalMicros *int64 `protobuf:"varint,1,opt,name=subtotal_micros,json=subtotalMicros,proto3,oneof" json:"subtotal_micros,omitempty"` + TaxMicros *int64 `protobuf:"varint,2,opt,name=tax_micros,json=taxMicros,proto3,oneof" json:"tax_micros,omitempty"` + TotalMicros *int64 `protobuf:"varint,3,opt,name=total_micros,json=totalMicros,proto3,oneof" json:"total_micros,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NestedTotals) Reset() { + *x = NestedTotals{} + mi := &file_slab_nested_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NestedTotals) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NestedTotals) ProtoMessage() {} + +func (x *NestedTotals) ProtoReflect() protoreflect.Message { + mi := &file_slab_nested_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NestedTotals.ProtoReflect.Descriptor instead. +func (*NestedTotals) Descriptor() ([]byte, []int) { + return file_slab_nested_proto_rawDescGZIP(), []int{10} +} + +func (x *NestedTotals) GetSubtotalMicros() int64 { + if x != nil && x.SubtotalMicros != nil { + return *x.SubtotalMicros + } + return 0 +} + +func (x *NestedTotals) GetTaxMicros() int64 { + if x != nil && x.TaxMicros != nil { + return *x.TaxMicros + } + return 0 +} + +func (x *NestedTotals) GetTotalMicros() int64 { + if x != nil && x.TotalMicros != nil { + return *x.TotalMicros + } + return 0 +} + +var File_slab_nested_proto protoreflect.FileDescriptor + +const file_slab_nested_proto_rawDesc = "" + + "\n" + + "\x11slab/nested.proto\x1a3github.com/planetscale/vtprotobuf/vtproto/ext.proto\"\xc6\x02\n" + + "\vNestedOrder\x12\x19\n" + + "\border_id\x18\x01 \x01(\tR\aorderId\x12\x1f\n" + + "\bsequence\x18\x02 \x01(\x03H\x00R\bsequence\x88\x01\x01\x12(\n" + + "\bcustomer\x18\x03 \x01(\v2\f.NestedPartyR\bcustomer\x12!\n" + + "\x05lines\x18\x04 \x03(\v2\v.NestedLineR\x05lines\x12-\n" + + "\x05notes\x18\x05 \x03(\v2\x17.NestedOrder.NotesEntryR\x05notes\x12%\n" + + "\x06totals\x18\x06 \x01(\v2\r.NestedTotalsR\x06totals\x1aE\n" + + "\n" + + "NotesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12!\n" + + "\x05value\x18\x02 \x01(\v2\v.NestedNoteR\x05value:\x028\x01:\x04\xb8\xa6\x1f\x01B\v\n" + + "\t_sequence\"\x9e\x01\n" + + "\vNestedParty\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\x06tax_id\x18\x02 \x01(\tH\x00R\x05taxId\x88\x01\x01\x12(\n" + + "\abilling\x18\x03 \x01(\v2\x0e.NestedAddressR\abilling\x12*\n" + + "\bdelivery\x18\x04 \x01(\v2\x0e.NestedAddressR\bdeliveryB\t\n" + + "\a_tax_id\"\xa0\x01\n" + + "\rNestedAddress\x12\x16\n" + + "\x06street\x18\x01 \x01(\tR\x06street\x12\x12\n" + + "\x04city\x18\x02 \x01(\tR\x04city\x12\x1b\n" + + "\x06region\x18\x03 \x01(\tH\x00R\x06region\x88\x01\x01\x12\x15\n" + + "\x03zip\x18\x04 \x01(\rH\x01R\x03zip\x88\x01\x01\x12\x1c\n" + + "\x03geo\x18\x05 \x01(\v2\n" + + ".NestedGeoR\x03geoB\t\n" + + "\a_regionB\x06\n" + + "\x04_zip\"]\n" + + "\tNestedGeo\x12\x10\n" + + "\x03lat\x18\x01 \x01(\x01R\x03lat\x12\x10\n" + + "\x03lon\x18\x02 \x01(\x01R\x03lon\x12\x1f\n" + + "\baccuracy\x18\x03 \x01(\x02H\x00R\baccuracy\x88\x01\x01B\v\n" + + "\t_accuracy\"\xb9\x02\n" + + "\n" + + "NestedLine\x12\x10\n" + + "\x03sku\x18\x01 \x01(\tR\x03sku\x12\x1f\n" + + "\bquantity\x18\x02 \x01(\x03H\x01R\bquantity\x88\x01\x01\x12\"\n" + + "\n" + + "unit_price\x18\x03 \x01(\x01H\x02R\tunitPrice\x88\x01\x01\x12(\n" + + "\aproduct\x18\x04 \x01(\v2\x0e.NestedProductR\aproduct\x12-\n" + + "\tdiscounts\x18\x05 \x03(\v2\x0f.NestedDiscountR\tdiscounts\x12%\n" + + "\x04ship\x18\x06 \x01(\v2\x0f.NestedShipmentH\x00R\x04ship\x12)\n" + + "\x0fpickup_location\x18\a \x01(\tH\x00R\x0epickupLocationB\r\n" + + "\vfulfillmentB\v\n" + + "\t_quantityB\r\n" + + "\v_unit_price\"\x8e\x02\n" + + "\rNestedProduct\x12\x14\n" + + "\x05title\x18\x01 \x01(\tR\x05title\x12\x1c\n" + + "\tthumbnail\x18\x02 \x01(\fR\tthumbnail\x12>\n" + + "\n" + + "attributes\x18\x03 \x03(\v2\x1e.NestedProduct.AttributesEntryR\n" + + "attributes\x12%\n" + + "\x04dims\x18\x04 \x01(\v2\x11.NestedDimensionsR\x04dims\x12\x19\n" + + "\x05brand\x18\x05 \x01(\tH\x00R\x05brand\x88\x01\x01\x1a=\n" + + "\x0fAttributesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\b\n" + + "\x06_brand\"\xb4\x01\n" + + "\x10NestedDimensions\x12\x19\n" + + "\x05width\x18\x01 \x01(\x01H\x00R\x05width\x88\x01\x01\x12\x1b\n" + + "\x06height\x18\x02 \x01(\x01H\x01R\x06height\x88\x01\x01\x12\x19\n" + + "\x05depth\x18\x03 \x01(\x01H\x02R\x05depth\x88\x01\x01\x12 \n" + + "\tweight_mg\x18\x04 \x01(\x04H\x03R\bweightMg\x88\x01\x01B\b\n" + + "\x06_widthB\t\n" + + "\a_heightB\b\n" + + "\x06_depthB\f\n" + + "\n" + + "_weight_mg\"`\n" + + "\x0eNestedDiscount\x12\x12\n" + + "\x04code\x18\x01 \x01(\tR\x04code\x12(\n" + + "\ramount_micros\x18\x02 \x01(\x12H\x00R\famountMicros\x88\x01\x01B\x10\n" + + "\x0e_amount_micros\"\x89\x01\n" + + "\x0eNestedShipment\x12\x18\n" + + "\acarrier\x18\x01 \x01(\tR\acarrier\x120\n" + + "\vdestination\x18\x02 \x01(\v2\x0e.NestedAddressR\vdestination\x12\x1e\n" + + "\beta_unix\x18\x03 \x01(\x06H\x00R\aetaUnix\x88\x01\x01B\v\n" + + "\t_eta_unix\"i\n" + + "\n" + + "NestedNote\x12\x16\n" + + "\x06author\x18\x01 \x01(\tR\x06author\x12\x12\n" + + "\x04text\x18\x02 \x01(\tR\x04text\x12!\n" + + "\ttimestamp\x18\x03 \x01(\x03H\x00R\ttimestamp\x88\x01\x01B\f\n" + + "\n" + + "_timestamp\"\xbc\x01\n" + + "\fNestedTotals\x12,\n" + + "\x0fsubtotal_micros\x18\x01 \x01(\x03H\x00R\x0esubtotalMicros\x88\x01\x01\x12\"\n" + + "\n" + + "tax_micros\x18\x02 \x01(\x03H\x01R\ttaxMicros\x88\x01\x01\x12&\n" + + "\ftotal_micros\x18\x03 \x01(\x03H\x02R\vtotalMicros\x88\x01\x01B\x12\n" + + "\x10_subtotal_microsB\r\n" + + "\v_tax_microsB\x0f\n" + + "\r_total_microsB\x10Z\x0etestproto/slabb\x06proto3" + +var ( + file_slab_nested_proto_rawDescOnce sync.Once + file_slab_nested_proto_rawDescData []byte +) + +func file_slab_nested_proto_rawDescGZIP() []byte { + file_slab_nested_proto_rawDescOnce.Do(func() { + file_slab_nested_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_slab_nested_proto_rawDesc), len(file_slab_nested_proto_rawDesc))) + }) + return file_slab_nested_proto_rawDescData +} + +var file_slab_nested_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_slab_nested_proto_goTypes = []any{ + (*NestedOrder)(nil), // 0: NestedOrder + (*NestedParty)(nil), // 1: NestedParty + (*NestedAddress)(nil), // 2: NestedAddress + (*NestedGeo)(nil), // 3: NestedGeo + (*NestedLine)(nil), // 4: NestedLine + (*NestedProduct)(nil), // 5: NestedProduct + (*NestedDimensions)(nil), // 6: NestedDimensions + (*NestedDiscount)(nil), // 7: NestedDiscount + (*NestedShipment)(nil), // 8: NestedShipment + (*NestedNote)(nil), // 9: NestedNote + (*NestedTotals)(nil), // 10: NestedTotals + nil, // 11: NestedOrder.NotesEntry + nil, // 12: NestedProduct.AttributesEntry +} +var file_slab_nested_proto_depIdxs = []int32{ + 1, // 0: NestedOrder.customer:type_name -> NestedParty + 4, // 1: NestedOrder.lines:type_name -> NestedLine + 11, // 2: NestedOrder.notes:type_name -> NestedOrder.NotesEntry + 10, // 3: NestedOrder.totals:type_name -> NestedTotals + 2, // 4: NestedParty.billing:type_name -> NestedAddress + 2, // 5: NestedParty.delivery:type_name -> NestedAddress + 3, // 6: NestedAddress.geo:type_name -> NestedGeo + 5, // 7: NestedLine.product:type_name -> NestedProduct + 7, // 8: NestedLine.discounts:type_name -> NestedDiscount + 8, // 9: NestedLine.ship:type_name -> NestedShipment + 12, // 10: NestedProduct.attributes:type_name -> NestedProduct.AttributesEntry + 6, // 11: NestedProduct.dims:type_name -> NestedDimensions + 2, // 12: NestedShipment.destination:type_name -> NestedAddress + 9, // 13: NestedOrder.NotesEntry.value:type_name -> NestedNote + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_slab_nested_proto_init() } +func file_slab_nested_proto_init() { + if File_slab_nested_proto != nil { + return + } + file_slab_nested_proto_msgTypes[0].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[1].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[2].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[3].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[4].OneofWrappers = []any{ + (*NestedLine_Ship)(nil), + (*NestedLine_PickupLocation)(nil), + } + file_slab_nested_proto_msgTypes[5].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[6].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[7].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[8].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[9].OneofWrappers = []any{} + file_slab_nested_proto_msgTypes[10].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_slab_nested_proto_rawDesc), len(file_slab_nested_proto_rawDesc)), + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_slab_nested_proto_goTypes, + DependencyIndexes: file_slab_nested_proto_depIdxs, + MessageInfos: file_slab_nested_proto_msgTypes, + }.Build() + File_slab_nested_proto = out.File + file_slab_nested_proto_goTypes = nil + file_slab_nested_proto_depIdxs = nil +} diff --git a/testproto/slab/nested.proto b/testproto/slab/nested.proto new file mode 100644 index 00000000..a5a728a0 --- /dev/null +++ b/testproto/slab/nested.proto @@ -0,0 +1,91 @@ +syntax = "proto3"; +option go_package = "testproto/slab"; + +import "github.com/planetscale/vtprotobuf/vtproto/ext.proto"; + +// A somewhat complex, deeply nested shape: four to five levels of messages +// with a mix of repeated, singular, map, oneof and optional-scalar fields at +// every level, mirroring a realistic "document" RPC payload. Used to +// benchmark slab decoding against the stock decoder on nested objects. + +message NestedOrder { + option (vtproto.slab) = true; + + string order_id = 1; + optional int64 sequence = 2; + NestedParty customer = 3; + repeated NestedLine lines = 4; + map notes = 5; + NestedTotals totals = 6; +} + +message NestedParty { + string name = 1; + optional string tax_id = 2; + NestedAddress billing = 3; + NestedAddress delivery = 4; +} + +message NestedAddress { + string street = 1; + string city = 2; + optional string region = 3; + optional uint32 zip = 4; + NestedGeo geo = 5; +} + +message NestedGeo { + double lat = 1; + double lon = 2; + optional float accuracy = 3; +} + +message NestedLine { + string sku = 1; + optional int64 quantity = 2; + optional double unit_price = 3; + NestedProduct product = 4; + repeated NestedDiscount discounts = 5; + oneof fulfillment { + NestedShipment ship = 6; + string pickup_location = 7; + } +} + +message NestedProduct { + string title = 1; + bytes thumbnail = 2; + map attributes = 3; + NestedDimensions dims = 4; + optional string brand = 5; +} + +message NestedDimensions { + optional double width = 1; + optional double height = 2; + optional double depth = 3; + optional uint64 weight_mg = 4; +} + +message NestedDiscount { + string code = 1; + optional sint64 amount_micros = 2; +} + +message NestedShipment { + string carrier = 1; + NestedAddress destination = 2; + optional fixed64 eta_unix = 3; +} + +message NestedNote { + string author = 1; + string text = 2; + optional int64 timestamp = 3; +} + +message NestedTotals { + optional int64 subtotal_micros = 1; + optional int64 tax_micros = 2; + optional int64 total_micros = 3; +} diff --git a/testproto/slab/nested_bench_test.go b/testproto/slab/nested_bench_test.go new file mode 100644 index 00000000..f9a551a3 --- /dev/null +++ b/testproto/slab/nested_bench_test.go @@ -0,0 +1,38 @@ +package slab + +import ( + "fmt" + "testing" +) + +// BenchmarkUnmarshalNested compares stock and slab decoding on a deeply +// nested document-style payload (four to five message levels, with maps, +// oneofs and optional scalars at every level). +func BenchmarkUnmarshalNested(b *testing.B) { + for _, lines := range []int{1, 8, 32, 128} { + data, err := makeNestedOrder(lines).MarshalVT() + if err != nil { + b.Fatal(err) + } + b.Run(fmt.Sprintf("stock/lines=%d", lines), func(b *testing.B) { + b.SetBytes(int64(len(data))) + b.ReportAllocs() + for i := 0; i < b.N; i++ { + m := &NestedOrder{} + if err := m.UnmarshalVT(data); err != nil { + b.Fatal(err) + } + } + }) + b.Run(fmt.Sprintf("slab/lines=%d", lines), func(b *testing.B) { + b.SetBytes(int64(len(data))) + b.ReportAllocs() + for i := 0; i < b.N; i++ { + m := &NestedOrder{} + if err := m.UnmarshalVTSlab(data); err != nil { + b.Fatal(err) + } + } + }) + } +} diff --git a/testproto/slab/nested_test.go b/testproto/slab/nested_test.go new file mode 100644 index 00000000..395b5871 --- /dev/null +++ b/testproto/slab/nested_test.go @@ -0,0 +1,144 @@ +package slab + +import ( + "fmt" + "testing" + + "google.golang.org/protobuf/proto" +) + +func makeNestedAddress(i int) *NestedAddress { + addr := &NestedAddress{ + Street: fmt.Sprintf("%d Main Street, Suite %d", 100+i, i), + City: "Springfield", + Geo: &NestedGeo{Lat: 47.6 + float64(i)/1000, Lon: -122.3 - float64(i)/1000}, + } + if i%2 == 0 { + addr.Region = ptr("WA") + addr.Zip = ptr(uint32(98100 + i)) + addr.Geo.Accuracy = ptr(float32(i%7) + 0.5) + } + return addr +} + +func makeNestedLine(i int) *NestedLine { + line := &NestedLine{ + Sku: fmt.Sprintf("SKU-%08d", i), + Product: &NestedProduct{ + Title: fmt.Sprintf("Product %d with a reasonably long title", i), + Thumbnail: []byte(fmt.Sprintf("thumbnail-bytes-%024d", i)), + Attributes: map[string]string{ + "color": fmt.Sprintf("color-%d", i%5), + "size": fmt.Sprintf("size-%d", i%3), + }, + Dims: &NestedDimensions{ + Width: ptr(1.5 * float64(i%10)), + Height: ptr(2.5 * float64(i%10)), + WeightMg: ptr(uint64(i) * 1000), + }, + }, + } + if i%2 == 0 { + line.Quantity = ptr(int64(i%9 + 1)) + line.UnitPrice = ptr(float64(i) * 1.99) + line.Product.Brand = ptr(fmt.Sprintf("brand-%d", i%4)) + line.Product.Dims.Depth = ptr(0.5 * float64(i%10)) + } + for d := 0; d < i%3; d++ { + line.Discounts = append(line.Discounts, &NestedDiscount{ + Code: fmt.Sprintf("SAVE%d", d), + AmountMicros: ptr(int64(-1000000 * (d + 1))), + }) + } + if i%2 == 0 { + line.Fulfillment = &NestedLine_Ship{Ship: &NestedShipment{ + Carrier: "ACME Logistics", + Destination: makeNestedAddress(i), + EtaUnix: ptr(uint64(1700000000 + i)), + }} + } else { + line.Fulfillment = &NestedLine_PickupLocation{PickupLocation: fmt.Sprintf("store-%d", i%10)} + } + return line +} + +func makeNestedOrder(lines int) *NestedOrder { + order := &NestedOrder{ + OrderId: "ORD-2026-000042", + Sequence: ptr(int64(42)), + Customer: &NestedParty{ + Name: "Some Rather Long Customer Name Inc.", + TaxId: ptr("TAX-123456789"), + Billing: makeNestedAddress(1), + Delivery: makeNestedAddress(2), + }, + Totals: &NestedTotals{ + SubtotalMicros: ptr(int64(123450000)), + TaxMicros: ptr(int64(12345000)), + TotalMicros: ptr(int64(135795000)), + }, + } + for i := 0; i < lines; i++ { + order.Lines = append(order.Lines, makeNestedLine(i)) + } + if lines > 0 { + order.Notes = map[string]*NestedNote{} + for i := 0; i < (lines+3)/4; i++ { + order.Notes[fmt.Sprintf("note-%d", i)] = &NestedNote{ + Author: fmt.Sprintf("author-%d", i), + Text: "please deliver behind the third flowerpot", + Timestamp: ptr(int64(1700000000 + i)), + } + } + } + return order +} + +func TestUnmarshalVTSlabNestedEquivalence(t *testing.T) { + for _, lines := range []int{0, 1, 4, 16, 64} { + t.Run(fmt.Sprintf("lines=%d", lines), func(t *testing.T) { + orig := makeNestedOrder(lines) + data, err := orig.MarshalVT() + if err != nil { + t.Fatal(err) + } + stock := &NestedOrder{} + if err := stock.UnmarshalVT(data); err != nil { + t.Fatal(err) + } + slab := &NestedOrder{} + if err := slab.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + if !proto.Equal(orig, slab) { + t.Fatal("slab-decoded nested message differs from original") + } + if !proto.Equal(stock, slab) { + t.Fatal("slab-decoded nested message differs from stock-decoded one") + } + }) + } +} + +func TestUnmarshalVTSlabNestedReducesAllocations(t *testing.T) { + data, err := makeNestedOrder(16).MarshalVT() + if err != nil { + t.Fatal(err) + } + stockAllocs := testing.AllocsPerRun(50, func() { + m := &NestedOrder{} + if err := m.UnmarshalVT(data); err != nil { + t.Fatal(err) + } + }) + slabAllocs := testing.AllocsPerRun(50, func() { + m := &NestedOrder{} + if err := m.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + }) + t.Logf("nested allocs/op: stock=%v slab=%v", stockAllocs, slabAllocs) + if slabAllocs >= stockAllocs { + t.Fatalf("slab decoding did not reduce allocations: stock=%v slab=%v", stockAllocs, slabAllocs) + } +} diff --git a/testproto/slab/nested_vtproto.pb.go b/testproto/slab/nested_vtproto.pb.go new file mode 100644 index 00000000..4e46cf29 --- /dev/null +++ b/testproto/slab/nested_vtproto.pb.go @@ -0,0 +1,8593 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: (devel) +// source: slab/nested.proto + +package slab + +import ( + binary "encoding/binary" + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + math "math" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *NestedOrder) CloneVT() *NestedOrder { + if m == nil { + return (*NestedOrder)(nil) + } + r := new(NestedOrder) + r.OrderId = m.OrderId + r.Customer = m.Customer.CloneVT() + r.Totals = m.Totals.CloneVT() + if rhs := m.Sequence; rhs != nil { + tmpVal := *rhs + r.Sequence = &tmpVal + } + if rhs := m.Lines; rhs != nil { + tmpContainer := make([]*NestedLine, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Lines = tmpContainer + } + if rhs := m.Notes; rhs != nil { + tmpContainer := make(map[string]*NestedNote, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Notes = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedOrder) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedParty) CloneVT() *NestedParty { + if m == nil { + return (*NestedParty)(nil) + } + r := new(NestedParty) + r.Name = m.Name + r.Billing = m.Billing.CloneVT() + r.Delivery = m.Delivery.CloneVT() + if rhs := m.TaxId; rhs != nil { + tmpVal := *rhs + r.TaxId = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedParty) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedAddress) CloneVT() *NestedAddress { + if m == nil { + return (*NestedAddress)(nil) + } + r := new(NestedAddress) + r.Street = m.Street + r.City = m.City + r.Geo = m.Geo.CloneVT() + if rhs := m.Region; rhs != nil { + tmpVal := *rhs + r.Region = &tmpVal + } + if rhs := m.Zip; rhs != nil { + tmpVal := *rhs + r.Zip = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedAddress) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedGeo) CloneVT() *NestedGeo { + if m == nil { + return (*NestedGeo)(nil) + } + r := new(NestedGeo) + r.Lat = m.Lat + r.Lon = m.Lon + if rhs := m.Accuracy; rhs != nil { + tmpVal := *rhs + r.Accuracy = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedGeo) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedLine) CloneVT() *NestedLine { + if m == nil { + return (*NestedLine)(nil) + } + r := new(NestedLine) + r.Sku = m.Sku + r.Product = m.Product.CloneVT() + if rhs := m.Quantity; rhs != nil { + tmpVal := *rhs + r.Quantity = &tmpVal + } + if rhs := m.UnitPrice; rhs != nil { + tmpVal := *rhs + r.UnitPrice = &tmpVal + } + if rhs := m.Discounts; rhs != nil { + tmpContainer := make([]*NestedDiscount, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Discounts = tmpContainer + } + if m.Fulfillment != nil { + r.Fulfillment = m.Fulfillment.(interface { + CloneVT() isNestedLine_Fulfillment + }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedLine) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedLine_Ship) CloneVT() isNestedLine_Fulfillment { + if m == nil { + return (*NestedLine_Ship)(nil) + } + r := new(NestedLine_Ship) + r.Ship = m.Ship.CloneVT() + return r +} + +func (m *NestedLine_PickupLocation) CloneVT() isNestedLine_Fulfillment { + if m == nil { + return (*NestedLine_PickupLocation)(nil) + } + r := new(NestedLine_PickupLocation) + r.PickupLocation = m.PickupLocation + return r +} + +func (m *NestedProduct) CloneVT() *NestedProduct { + if m == nil { + return (*NestedProduct)(nil) + } + r := new(NestedProduct) + r.Title = m.Title + r.Dims = m.Dims.CloneVT() + if rhs := m.Thumbnail; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Thumbnail = tmpBytes + } + if rhs := m.Attributes; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.Attributes = tmpContainer + } + if rhs := m.Brand; rhs != nil { + tmpVal := *rhs + r.Brand = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedProduct) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedDimensions) CloneVT() *NestedDimensions { + if m == nil { + return (*NestedDimensions)(nil) + } + r := new(NestedDimensions) + if rhs := m.Width; rhs != nil { + tmpVal := *rhs + r.Width = &tmpVal + } + if rhs := m.Height; rhs != nil { + tmpVal := *rhs + r.Height = &tmpVal + } + if rhs := m.Depth; rhs != nil { + tmpVal := *rhs + r.Depth = &tmpVal + } + if rhs := m.WeightMg; rhs != nil { + tmpVal := *rhs + r.WeightMg = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedDimensions) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedDiscount) CloneVT() *NestedDiscount { + if m == nil { + return (*NestedDiscount)(nil) + } + r := new(NestedDiscount) + r.Code = m.Code + if rhs := m.AmountMicros; rhs != nil { + tmpVal := *rhs + r.AmountMicros = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedDiscount) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedShipment) CloneVT() *NestedShipment { + if m == nil { + return (*NestedShipment)(nil) + } + r := new(NestedShipment) + r.Carrier = m.Carrier + r.Destination = m.Destination.CloneVT() + if rhs := m.EtaUnix; rhs != nil { + tmpVal := *rhs + r.EtaUnix = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedShipment) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedNote) CloneVT() *NestedNote { + if m == nil { + return (*NestedNote)(nil) + } + r := new(NestedNote) + r.Author = m.Author + r.Text = m.Text + if rhs := m.Timestamp; rhs != nil { + tmpVal := *rhs + r.Timestamp = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedNote) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *NestedTotals) CloneVT() *NestedTotals { + if m == nil { + return (*NestedTotals)(nil) + } + r := new(NestedTotals) + if rhs := m.SubtotalMicros; rhs != nil { + tmpVal := *rhs + r.SubtotalMicros = &tmpVal + } + if rhs := m.TaxMicros; rhs != nil { + tmpVal := *rhs + r.TaxMicros = &tmpVal + } + if rhs := m.TotalMicros; rhs != nil { + tmpVal := *rhs + r.TotalMicros = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *NestedTotals) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *NestedOrder) EqualVT(that *NestedOrder) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.OrderId != that.OrderId { + return false + } + if p, q := this.Sequence, that.Sequence; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if !this.Customer.EqualVT(that.Customer) { + return false + } + if len(this.Lines) != len(that.Lines) { + return false + } + for i, vx := range this.Lines { + vy := that.Lines[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &NestedLine{} + } + if q == nil { + q = &NestedLine{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Notes) != len(that.Notes) { + return false + } + for i, vx := range this.Notes { + vy, ok := that.Notes[i] + if !ok { + return false + } + if p, q := vx, vy; p != q { + if p == nil { + p = &NestedNote{} + } + if q == nil { + q = &NestedNote{} + } + if !p.EqualVT(q) { + return false + } + } + } + if !this.Totals.EqualVT(that.Totals) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedOrder) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedOrder) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedParty) EqualVT(that *NestedParty) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if p, q := this.TaxId, that.TaxId; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if !this.Billing.EqualVT(that.Billing) { + return false + } + if !this.Delivery.EqualVT(that.Delivery) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedParty) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedParty) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedAddress) EqualVT(that *NestedAddress) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Street != that.Street { + return false + } + if this.City != that.City { + return false + } + if p, q := this.Region, that.Region; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Zip, that.Zip; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if !this.Geo.EqualVT(that.Geo) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedAddress) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedAddress) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedGeo) EqualVT(that *NestedGeo) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Lat != that.Lat { + return false + } + if this.Lon != that.Lon { + return false + } + if p, q := this.Accuracy, that.Accuracy; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedGeo) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedGeo) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedLine) EqualVT(that *NestedLine) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Fulfillment == nil && that.Fulfillment != nil { + return false + } else if this.Fulfillment != nil { + if that.Fulfillment == nil { + return false + } + if !this.Fulfillment.(interface { + EqualVT(isNestedLine_Fulfillment) bool + }).EqualVT(that.Fulfillment) { + return false + } + } + if this.Sku != that.Sku { + return false + } + if p, q := this.Quantity, that.Quantity; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.UnitPrice, that.UnitPrice; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if !this.Product.EqualVT(that.Product) { + return false + } + if len(this.Discounts) != len(that.Discounts) { + return false + } + for i, vx := range this.Discounts { + vy := that.Discounts[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &NestedDiscount{} + } + if q == nil { + q = &NestedDiscount{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedLine) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedLine) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedLine_Ship) EqualVT(thatIface isNestedLine_Fulfillment) bool { + that, ok := thatIface.(*NestedLine_Ship) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Ship, that.Ship; p != q { + if p == nil { + p = &NestedShipment{} + } + if q == nil { + q = &NestedShipment{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *NestedLine_PickupLocation) EqualVT(thatIface isNestedLine_Fulfillment) bool { + that, ok := thatIface.(*NestedLine_PickupLocation) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.PickupLocation != that.PickupLocation { + return false + } + return true +} + +func (this *NestedProduct) EqualVT(that *NestedProduct) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Title != that.Title { + return false + } + if string(this.Thumbnail) != string(that.Thumbnail) { + return false + } + if len(this.Attributes) != len(that.Attributes) { + return false + } + for i, vx := range this.Attributes { + vy, ok := that.Attributes[i] + if !ok { + return false + } + if vx != vy { + return false + } + } + if !this.Dims.EqualVT(that.Dims) { + return false + } + if p, q := this.Brand, that.Brand; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedProduct) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedProduct) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedDimensions) EqualVT(that *NestedDimensions) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if p, q := this.Width, that.Width; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Height, that.Height; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Depth, that.Depth; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.WeightMg, that.WeightMg; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedDimensions) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedDimensions) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedDiscount) EqualVT(that *NestedDiscount) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Code != that.Code { + return false + } + if p, q := this.AmountMicros, that.AmountMicros; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedDiscount) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedDiscount) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedShipment) EqualVT(that *NestedShipment) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Carrier != that.Carrier { + return false + } + if !this.Destination.EqualVT(that.Destination) { + return false + } + if p, q := this.EtaUnix, that.EtaUnix; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedShipment) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedShipment) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedNote) EqualVT(that *NestedNote) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Author != that.Author { + return false + } + if this.Text != that.Text { + return false + } + if p, q := this.Timestamp, that.Timestamp; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedNote) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedNote) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *NestedTotals) EqualVT(that *NestedTotals) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if p, q := this.SubtotalMicros, that.SubtotalMicros; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.TaxMicros, that.TaxMicros; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.TotalMicros, that.TotalMicros; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *NestedTotals) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*NestedTotals) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *NestedOrder) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedOrder) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedOrder) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Totals != nil { + size, err := m.Totals.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + if len(m.Notes) > 0 { + for k := range m.Notes { + v := m.Notes[k] + baseI := i + size, err := v.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2a + } + } + if len(m.Lines) > 0 { + for iNdEx := len(m.Lines) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Lines[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + } + if m.Customer != nil { + size, err := m.Customer.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.Sequence != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.OrderId) > 0 { + i -= len(m.OrderId) + copy(dAtA[i:], m.OrderId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.OrderId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedParty) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedParty) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedParty) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Delivery != nil { + size, err := m.Delivery.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if m.Billing != nil { + size, err := m.Billing.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.TaxId != nil { + i -= len(*m.TaxId) + copy(dAtA[i:], *m.TaxId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.TaxId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedAddress) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedAddress) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedAddress) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Geo != nil { + size, err := m.Geo.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + if m.Zip != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Zip)) + i-- + dAtA[i] = 0x20 + } + if m.Region != nil { + i -= len(*m.Region) + copy(dAtA[i:], *m.Region) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.Region))) + i-- + dAtA[i] = 0x1a + } + if len(m.City) > 0 { + i -= len(m.City) + copy(dAtA[i:], m.City) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.City))) + i-- + dAtA[i] = 0x12 + } + if len(m.Street) > 0 { + i -= len(m.Street) + copy(dAtA[i:], m.Street) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Street))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedGeo) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedGeo) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedGeo) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Accuracy != nil { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(*m.Accuracy)))) + i-- + dAtA[i] = 0x1d + } + if m.Lon != 0 { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Lon)))) + i-- + dAtA[i] = 0x11 + } + if m.Lat != 0 { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Lat)))) + i-- + dAtA[i] = 0x9 + } + return len(dAtA) - i, nil +} + +func (m *NestedLine) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedLine) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedLine) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Fulfillment.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if len(m.Discounts) > 0 { + for iNdEx := len(m.Discounts) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Discounts[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + } + if m.Product != nil { + size, err := m.Product.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if m.UnitPrice != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.UnitPrice)))) + i-- + dAtA[i] = 0x19 + } + if m.Quantity != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Quantity)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sku) > 0 { + i -= len(m.Sku) + copy(dAtA[i:], m.Sku) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sku))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedLine_Ship) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedLine_Ship) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Ship != nil { + size, err := m.Ship.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } else { + i = protohelpers.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *NestedLine_PickupLocation) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedLine_PickupLocation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.PickupLocation) + copy(dAtA[i:], m.PickupLocation) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PickupLocation))) + i-- + dAtA[i] = 0x3a + return len(dAtA) - i, nil +} +func (m *NestedProduct) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedProduct) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedProduct) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Brand != nil { + i -= len(*m.Brand) + copy(dAtA[i:], *m.Brand) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.Brand))) + i-- + dAtA[i] = 0x2a + } + if m.Dims != nil { + size, err := m.Dims.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Thumbnail) > 0 { + i -= len(m.Thumbnail) + copy(dAtA[i:], m.Thumbnail) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Thumbnail))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedDimensions) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedDimensions) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedDimensions) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.WeightMg != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.WeightMg)) + i-- + dAtA[i] = 0x20 + } + if m.Depth != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Depth)))) + i-- + dAtA[i] = 0x19 + } + if m.Height != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Height)))) + i-- + dAtA[i] = 0x11 + } + if m.Width != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Width)))) + i-- + dAtA[i] = 0x9 + } + return len(dAtA) - i, nil +} + +func (m *NestedDiscount) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedDiscount) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedDiscount) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.AmountMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64((uint64(*m.AmountMicros)<<1)^uint64((*m.AmountMicros>>63)))) + i-- + dAtA[i] = 0x10 + } + if len(m.Code) > 0 { + i -= len(m.Code) + copy(dAtA[i:], m.Code) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Code))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedShipment) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedShipment) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedShipment) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.EtaUnix != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(*m.EtaUnix)) + i-- + dAtA[i] = 0x19 + } + if m.Destination != nil { + size, err := m.Destination.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.Carrier) > 0 { + i -= len(m.Carrier) + copy(dAtA[i:], m.Carrier) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Carrier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedNote) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedNote) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedNote) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Timestamp != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Timestamp)) + i-- + dAtA[i] = 0x18 + } + if len(m.Text) > 0 { + i -= len(m.Text) + copy(dAtA[i:], m.Text) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Text))) + i-- + dAtA[i] = 0x12 + } + if len(m.Author) > 0 { + i -= len(m.Author) + copy(dAtA[i:], m.Author) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Author))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedTotals) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedTotals) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *NestedTotals) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.TotalMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.TotalMicros)) + i-- + dAtA[i] = 0x18 + } + if m.TaxMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.TaxMicros)) + i-- + dAtA[i] = 0x10 + } + if m.SubtotalMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.SubtotalMicros)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *NestedOrder) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedOrder) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedOrder) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Totals != nil { + size, err := m.Totals.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + if len(m.Notes) > 0 { + for k := range m.Notes { + v := m.Notes[k] + baseI := i + size, err := v.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2a + } + } + if len(m.Lines) > 0 { + for iNdEx := len(m.Lines) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Lines[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + } + if m.Customer != nil { + size, err := m.Customer.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.Sequence != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.OrderId) > 0 { + i -= len(m.OrderId) + copy(dAtA[i:], m.OrderId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.OrderId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedParty) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedParty) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedParty) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Delivery != nil { + size, err := m.Delivery.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if m.Billing != nil { + size, err := m.Billing.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.TaxId != nil { + i -= len(*m.TaxId) + copy(dAtA[i:], *m.TaxId) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.TaxId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedAddress) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedAddress) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedAddress) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Geo != nil { + size, err := m.Geo.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + if m.Zip != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Zip)) + i-- + dAtA[i] = 0x20 + } + if m.Region != nil { + i -= len(*m.Region) + copy(dAtA[i:], *m.Region) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.Region))) + i-- + dAtA[i] = 0x1a + } + if len(m.City) > 0 { + i -= len(m.City) + copy(dAtA[i:], m.City) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.City))) + i-- + dAtA[i] = 0x12 + } + if len(m.Street) > 0 { + i -= len(m.Street) + copy(dAtA[i:], m.Street) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Street))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedGeo) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedGeo) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedGeo) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Accuracy != nil { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(*m.Accuracy)))) + i-- + dAtA[i] = 0x1d + } + if m.Lon != 0 { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Lon)))) + i-- + dAtA[i] = 0x11 + } + if m.Lat != 0 { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Lat)))) + i-- + dAtA[i] = 0x9 + } + return len(dAtA) - i, nil +} + +func (m *NestedLine) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedLine) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedLine) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if msg, ok := m.Fulfillment.(*NestedLine_PickupLocation); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if msg, ok := m.Fulfillment.(*NestedLine_Ship); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if len(m.Discounts) > 0 { + for iNdEx := len(m.Discounts) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Discounts[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + } + if m.Product != nil { + size, err := m.Product.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if m.UnitPrice != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.UnitPrice)))) + i-- + dAtA[i] = 0x19 + } + if m.Quantity != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Quantity)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sku) > 0 { + i -= len(m.Sku) + copy(dAtA[i:], m.Sku) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sku))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedLine_Ship) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedLine_Ship) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Ship != nil { + size, err := m.Ship.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } else { + i = protohelpers.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *NestedLine_PickupLocation) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedLine_PickupLocation) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.PickupLocation) + copy(dAtA[i:], m.PickupLocation) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PickupLocation))) + i-- + dAtA[i] = 0x3a + return len(dAtA) - i, nil +} +func (m *NestedProduct) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedProduct) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedProduct) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Brand != nil { + i -= len(*m.Brand) + copy(dAtA[i:], *m.Brand) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.Brand))) + i-- + dAtA[i] = 0x2a + } + if m.Dims != nil { + size, err := m.Dims.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Thumbnail) > 0 { + i -= len(m.Thumbnail) + copy(dAtA[i:], m.Thumbnail) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Thumbnail))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedDimensions) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedDimensions) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedDimensions) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.WeightMg != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.WeightMg)) + i-- + dAtA[i] = 0x20 + } + if m.Depth != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Depth)))) + i-- + dAtA[i] = 0x19 + } + if m.Height != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Height)))) + i-- + dAtA[i] = 0x11 + } + if m.Width != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Width)))) + i-- + dAtA[i] = 0x9 + } + return len(dAtA) - i, nil +} + +func (m *NestedDiscount) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedDiscount) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedDiscount) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.AmountMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64((uint64(*m.AmountMicros)<<1)^uint64((*m.AmountMicros>>63)))) + i-- + dAtA[i] = 0x10 + } + if len(m.Code) > 0 { + i -= len(m.Code) + copy(dAtA[i:], m.Code) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Code))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedShipment) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedShipment) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedShipment) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.EtaUnix != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(*m.EtaUnix)) + i-- + dAtA[i] = 0x19 + } + if m.Destination != nil { + size, err := m.Destination.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.Carrier) > 0 { + i -= len(m.Carrier) + copy(dAtA[i:], m.Carrier) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Carrier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedNote) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedNote) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedNote) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Timestamp != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Timestamp)) + i-- + dAtA[i] = 0x18 + } + if len(m.Text) > 0 { + i -= len(m.Text) + copy(dAtA[i:], m.Text) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Text))) + i-- + dAtA[i] = 0x12 + } + if len(m.Author) > 0 { + i -= len(m.Author) + copy(dAtA[i:], m.Author) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Author))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NestedTotals) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NestedTotals) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *NestedTotals) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.TotalMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.TotalMicros)) + i-- + dAtA[i] = 0x18 + } + if m.TaxMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.TaxMicros)) + i-- + dAtA[i] = 0x10 + } + if m.SubtotalMicros != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.SubtotalMicros)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *NestedOrder) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OrderId) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Sequence != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Sequence)) + } + if m.Customer != nil { + l = m.Customer.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Lines) > 0 { + for _, e := range m.Lines { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if len(m.Notes) > 0 { + for k, v := range m.Notes { + _ = k + _ = v + l = 0 + if v != nil { + l = v.SizeVT() + } + l += 1 + protohelpers.SizeOfVarint(uint64(l)) + mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) + } + } + if m.Totals != nil { + l = m.Totals.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedParty) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.TaxId != nil { + l = len(*m.TaxId) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Billing != nil { + l = m.Billing.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Delivery != nil { + l = m.Delivery.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedAddress) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Street) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.City) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Region != nil { + l = len(*m.Region) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Zip != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Zip)) + } + if m.Geo != nil { + l = m.Geo.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedGeo) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Lat != 0 { + n += 9 + } + if m.Lon != 0 { + n += 9 + } + if m.Accuracy != nil { + n += 5 + } + n += len(m.unknownFields) + return n +} + +func (m *NestedLine) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sku) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Quantity != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Quantity)) + } + if m.UnitPrice != nil { + n += 9 + } + if m.Product != nil { + l = m.Product.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Discounts) > 0 { + for _, e := range m.Discounts { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if vtmsg, ok := m.Fulfillment.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *NestedLine_Ship) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ship != nil { + l = m.Ship.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *NestedLine_PickupLocation) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PickupLocation) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + return n +} +func (m *NestedProduct) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Thumbnail) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + 1 + len(v) + protohelpers.SizeOfVarint(uint64(len(v))) + n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) + } + } + if m.Dims != nil { + l = m.Dims.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Brand != nil { + l = len(*m.Brand) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedDimensions) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Width != nil { + n += 9 + } + if m.Height != nil { + n += 9 + } + if m.Depth != nil { + n += 9 + } + if m.WeightMg != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.WeightMg)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedDiscount) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Code) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.AmountMicros != nil { + n += 1 + protohelpers.SizeOfZigzag(uint64(*m.AmountMicros)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedShipment) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Carrier) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Destination != nil { + l = m.Destination.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.EtaUnix != nil { + n += 9 + } + n += len(m.unknownFields) + return n +} + +func (m *NestedNote) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Author) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Text) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Timestamp != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Timestamp)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedTotals) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SubtotalMicros != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.SubtotalMicros)) + } + if m.TaxMicros != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.TaxMicros)) + } + if m.TotalMicros != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.TotalMicros)) + } + n += len(m.unknownFields) + return n +} + +func (m *NestedOrder) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OrderId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sequence = &v + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Customer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Customer == nil { + m.Customer = &NestedParty{} + } + if err := m.Customer.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lines", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Lines = append(m.Lines, &NestedLine{}) + if err := m.Lines[len(m.Lines)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Notes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Notes == nil { + m.Notes = make(map[string]*NestedNote) + } + var mapkey string + var mapvalue *NestedNote + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protohelpers.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NestedNote{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Notes[mapkey] = mapvalue + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Totals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Totals == nil { + m.Totals = &NestedTotals{} + } + if err := m.Totals.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedParty) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedParty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedParty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaxId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.TaxId = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Billing", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Billing == nil { + m.Billing = &NestedAddress{} + } + if err := m.Billing.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delivery", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Delivery == nil { + m.Delivery = &NestedAddress{} + } + if err := m.Delivery.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedAddress) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Street", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Street = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field City", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.City = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Region = &s + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Zip", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Zip = &v + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Geo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Geo == nil { + m.Geo = &NestedGeo{} + } + if err := m.Geo.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedGeo) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedGeo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedGeo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Lat", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Lat = float64(math.Float64frombits(v)) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Lon", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Lon = float64(math.Float64frombits(v)) + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Accuracy", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.Accuracy = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedLine) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedLine: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedLine: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sku", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sku = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Quantity = &v + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field UnitPrice", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.UnitPrice = &v2 + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Product", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Product == nil { + m.Product = &NestedProduct{} + } + if err := m.Product.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Discounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Discounts = append(m.Discounts, &NestedDiscount{}) + if err := m.Discounts[len(m.Discounts)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ship", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Fulfillment.(*NestedLine_Ship); ok { + if err := oneof.Ship.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &NestedShipment{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Fulfillment = &NestedLine_Ship{Ship: v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PickupLocation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fulfillment = &NestedLine_PickupLocation{PickupLocation: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedProduct) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedProduct: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedProduct: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Thumbnail", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Thumbnail = append(m.Thumbnail[:0], dAtA[iNdEx:postIndex]...) + if m.Thumbnail == nil { + m.Thumbnail = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dims == nil { + m.Dims = &NestedDimensions{} + } + if err := m.Dims.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Brand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Brand = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedDimensions) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedDimensions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedDimensions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Width = &v2 + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Height = &v2 + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Depth", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Depth = &v2 + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightMg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WeightMg = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedDiscount) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedDiscount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedDiscount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Code = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountMicros", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.AmountMicros = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedShipment) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedShipment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedShipment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Carrier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Carrier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Destination == nil { + m.Destination = &NestedAddress{} + } + if err := m.Destination.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field EtaUnix", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.EtaUnix = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedNote) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedNote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedNote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Author = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Text = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Timestamp = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedTotals) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedTotals: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedTotals: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubtotalMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SubtotalMicros = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TaxMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TaxMicros = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TotalMicros = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +// slabArena_slab_nested_proto holds the slabs backing the UnmarshalVTSlab entry +// points of this file. One arena lives for the duration of a single +// top-level unmarshal call. +type slabArena_slab_nested_proto struct { + f_int64 protohelpers.Slab[int64] + f_NestedParty protohelpers.Slab[NestedParty] + f_NestedLine protohelpers.Slab[NestedLine] + f_NestedNote protohelpers.Slab[NestedNote] + f_NestedTotals protohelpers.Slab[NestedTotals] + f_string protohelpers.Slab[string] + f_NestedAddress protohelpers.Slab[NestedAddress] + f_uint32 protohelpers.Slab[uint32] + f_NestedGeo protohelpers.Slab[NestedGeo] + f_float32 protohelpers.Slab[float32] + f_float64 protohelpers.Slab[float64] + f_NestedProduct protohelpers.Slab[NestedProduct] + f_NestedDiscount protohelpers.Slab[NestedDiscount] + f_NestedShipment protohelpers.Slab[NestedShipment] + f_NestedDimensions protohelpers.Slab[NestedDimensions] + f_uint64 protohelpers.Slab[uint64] +} + +// UnmarshalVTSlab is like UnmarshalVT, but allocates nested message +// elements and scalar presence pointers from chunked slabs sized by a +// counting pre-pass over the wire format. Retaining any pointer into +// the decoded message pins that pointer's whole chunk in memory: use +// it for messages whose lifetime ends with the RPC that carried them. +func (m *NestedOrder) UnmarshalVTSlab(dAtA []byte) error { + if len(dAtA) < protohelpers.SlabUnmarshalThreshold { + return m.UnmarshalVT(dAtA) + } + var a slabArena_slab_nested_proto + fieldNums := [2]int32{4, 5} + var counts [2]int + protohelpers.CountFields(dAtA, fieldNums[:], counts[:]) + if counts[0]+counts[1] < protohelpers.SlabUnmarshalMinCount { + return m.UnmarshalVT(dAtA) + } + a.f_NestedParty.Reserve(1) + a.f_NestedLine.Reserve(counts[0]) + a.f_NestedNote.Reserve(counts[1]) + a.f_NestedTotals.Reserve(1) + a.f_NestedAddress.Reserve(2) + a.f_NestedGeo.Reserve(2) + a.f_NestedProduct.Reserve(counts[0]) + a.f_NestedDimensions.Reserve(counts[0]) + return m.unmarshalVTSlab(dAtA, &a) +} + +func (m *NestedOrder) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OrderId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sequence = a.f_int64.NextValue(v) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Customer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Customer == nil { + m.Customer = a.f_NestedParty.Next() + } + if err := m.Customer.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lines", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Lines = append(m.Lines, a.f_NestedLine.Next()) + if err := m.Lines[len(m.Lines)-1].unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Notes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Notes == nil { + m.Notes = make(map[string]*NestedNote) + } + var mapkey string + var mapvalue *NestedNote + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protohelpers.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = a.f_NestedNote.Next() + if err := mapvalue.unmarshalVTSlab(dAtA[iNdEx:postmsgIndex], a); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Notes[mapkey] = mapvalue + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Totals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Totals == nil { + m.Totals = a.f_NestedTotals.Next() + } + if err := m.Totals.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedParty) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedParty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedParty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaxId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaxId = a.f_string.NextValue(string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Billing", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Billing == nil { + m.Billing = a.f_NestedAddress.Next() + } + if err := m.Billing.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delivery", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Delivery == nil { + m.Delivery = a.f_NestedAddress.Next() + } + if err := m.Delivery.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedAddress) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Street", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Street = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field City", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.City = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Region = a.f_string.NextValue(string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Zip", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Zip = a.f_uint32.NextValue(v) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Geo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Geo == nil { + m.Geo = a.f_NestedGeo.Next() + } + if err := m.Geo.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedGeo) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedGeo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedGeo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Lat", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Lat = float64(math.Float64frombits(v)) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Lon", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Lon = float64(math.Float64frombits(v)) + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Accuracy", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Accuracy = a.f_float32.NextValue(float32(math.Float32frombits(v))) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedLine) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedLine: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedLine: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sku", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sku = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Quantity = a.f_int64.NextValue(v) + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field UnitPrice", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.UnitPrice = a.f_float64.NextValue(float64(math.Float64frombits(v))) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Product", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Product == nil { + m.Product = a.f_NestedProduct.Next() + } + if err := m.Product.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Discounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Discounts = append(m.Discounts, a.f_NestedDiscount.Next()) + if err := m.Discounts[len(m.Discounts)-1].unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ship", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Fulfillment.(*NestedLine_Ship); ok { + if err := oneof.Ship.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + } else { + v := a.f_NestedShipment.Next() + if err := v.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + m.Fulfillment = &NestedLine_Ship{Ship: v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PickupLocation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fulfillment = &NestedLine_PickupLocation{PickupLocation: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedProduct) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedProduct: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedProduct: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Thumbnail", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Thumbnail = append(m.Thumbnail[:0], dAtA[iNdEx:postIndex]...) + if m.Thumbnail == nil { + m.Thumbnail = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dims == nil { + m.Dims = a.f_NestedDimensions.Next() + } + if err := m.Dims.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Brand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Brand = a.f_string.NextValue(string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedDimensions) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedDimensions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedDimensions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Width = a.f_float64.NextValue(float64(math.Float64frombits(v))) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Height = a.f_float64.NextValue(float64(math.Float64frombits(v))) + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Depth", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Depth = a.f_float64.NextValue(float64(math.Float64frombits(v))) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightMg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WeightMg = a.f_uint64.NextValue(v) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedDiscount) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedDiscount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedDiscount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Code = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountMicros", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.AmountMicros = a.f_int64.NextValue(int64(v)) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedShipment) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedShipment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedShipment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Carrier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Carrier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Destination == nil { + m.Destination = a.f_NestedAddress.Next() + } + if err := m.Destination.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field EtaUnix", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.EtaUnix = a.f_uint64.NextValue(v) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedNote) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedNote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedNote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Author = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Text = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Timestamp = a.f_int64.NextValue(v) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedTotals) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_nested_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedTotals: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedTotals: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubtotalMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SubtotalMicros = a.f_int64.NextValue(v) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TaxMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TaxMicros = a.f_int64.NextValue(v) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TotalMicros = a.f_int64.NextValue(v) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedOrder) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.OrderId = stringValue + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sequence = &v + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Customer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Customer == nil { + m.Customer = &NestedParty{} + } + if err := m.Customer.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lines", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Lines = append(m.Lines, &NestedLine{}) + if err := m.Lines[len(m.Lines)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Notes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Notes == nil { + m.Notes = make(map[string]*NestedNote) + } + var mapkey string + var mapvalue *NestedNote + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapkey == 0 { + mapkey = "" + } else { + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) + } + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protohelpers.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NestedNote{} + if err := mapvalue.UnmarshalVTUnsafe(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Notes[mapkey] = mapvalue + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Totals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Totals == nil { + m.Totals = &NestedTotals{} + } + if err := m.Totals.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedParty) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedParty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedParty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Name = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaxId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + s := stringValue + m.TaxId = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Billing", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Billing == nil { + m.Billing = &NestedAddress{} + } + if err := m.Billing.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delivery", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Delivery == nil { + m.Delivery = &NestedAddress{} + } + if err := m.Delivery.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedAddress) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Street", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Street = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field City", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.City = stringValue + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + s := stringValue + m.Region = &s + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Zip", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Zip = &v + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Geo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Geo == nil { + m.Geo = &NestedGeo{} + } + if err := m.Geo.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedGeo) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedGeo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedGeo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Lat", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Lat = float64(math.Float64frombits(v)) + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Lon", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Lon = float64(math.Float64frombits(v)) + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Accuracy", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.Accuracy = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedLine) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedLine: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedLine: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sku", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Sku = stringValue + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Quantity = &v + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field UnitPrice", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.UnitPrice = &v2 + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Product", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Product == nil { + m.Product = &NestedProduct{} + } + if err := m.Product.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Discounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Discounts = append(m.Discounts, &NestedDiscount{}) + if err := m.Discounts[len(m.Discounts)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ship", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Fulfillment.(*NestedLine_Ship); ok { + if err := oneof.Ship.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &NestedShipment{} + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Fulfillment = &NestedLine_Ship{Ship: v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PickupLocation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Fulfillment = &NestedLine_PickupLocation{PickupLocation: stringValue} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedProduct) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedProduct: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedProduct: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Title = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Thumbnail", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Thumbnail = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapkey == 0 { + mapkey = "" + } else { + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) + } + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapvalue == 0 { + mapvalue = "" + } else { + mapvalue = unsafe.String(&dAtA[iNdEx], intStringLenmapvalue) + } + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dims == nil { + m.Dims = &NestedDimensions{} + } + if err := m.Dims.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Brand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + s := stringValue + m.Brand = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedDimensions) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedDimensions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedDimensions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Width = &v2 + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Height = &v2 + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Depth", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Depth = &v2 + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightMg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WeightMg = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedDiscount) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedDiscount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedDiscount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Code = stringValue + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountMicros", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.AmountMicros = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedShipment) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedShipment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedShipment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Carrier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Carrier = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Destination == nil { + m.Destination = &NestedAddress{} + } + if err := m.Destination.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field EtaUnix", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.EtaUnix = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedNote) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedNote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedNote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Author = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Text = stringValue + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Timestamp = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NestedTotals) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NestedTotals: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NestedTotals: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubtotalMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SubtotalMicros = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TaxMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TaxMicros = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMicros", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TotalMicros = &v + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/testproto/slab/slab.pb.go b/testproto/slab/slab.pb.go new file mode 100644 index 00000000..1f0e9ce1 --- /dev/null +++ b/testproto/slab/slab.pb.go @@ -0,0 +1,617 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v3.21.12 +// source: slab/slab.proto + +package slab + +import ( + _ "github.com/planetscale/vtprotobuf/vtproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SlabFlavor int32 + +const ( + SlabFlavor_SLAB_FLAVOR_UNSPECIFIED SlabFlavor = 0 + SlabFlavor_SLAB_FLAVOR_SWEET SlabFlavor = 1 + SlabFlavor_SLAB_FLAVOR_SOUR SlabFlavor = 2 +) + +// Enum value maps for SlabFlavor. +var ( + SlabFlavor_name = map[int32]string{ + 0: "SLAB_FLAVOR_UNSPECIFIED", + 1: "SLAB_FLAVOR_SWEET", + 2: "SLAB_FLAVOR_SOUR", + } + SlabFlavor_value = map[string]int32{ + "SLAB_FLAVOR_UNSPECIFIED": 0, + "SLAB_FLAVOR_SWEET": 1, + "SLAB_FLAVOR_SOUR": 2, + } +) + +func (x SlabFlavor) Enum() *SlabFlavor { + p := new(SlabFlavor) + *p = x + return p +} + +func (x SlabFlavor) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SlabFlavor) Descriptor() protoreflect.EnumDescriptor { + return file_slab_slab_proto_enumTypes[0].Descriptor() +} + +func (SlabFlavor) Type() protoreflect.EnumType { + return &file_slab_slab_proto_enumTypes[0] +} + +func (x SlabFlavor) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SlabFlavor.Descriptor instead. +func (SlabFlavor) EnumDescriptor() ([]byte, []int) { + return file_slab_slab_proto_rawDescGZIP(), []int{0} +} + +type SlabBatch struct { + state protoimpl.MessageState `protogen:"open.v1"` + Shard *int64 `protobuf:"varint,1,opt,name=shard,proto3,oneof" json:"shard,omitempty"` + Items []*SlabItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + Ranges []*SlabRange `protobuf:"bytes,3,rep,name=ranges,proto3" json:"ranges,omitempty"` + Index map[string]*SlabItem `protobuf:"bytes,4,rep,name=index,proto3" json:"index,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Meta *SlabMeta `protobuf:"bytes,5,opt,name=meta,proto3" json:"meta,omitempty"` + // Types that are valid to be assigned to Extra: + // + // *SlabBatch_ExtraItem + // *SlabBatch_Note + Extra isSlabBatch_Extra `protobuf_oneof:"extra"` + PackedIds []int64 `protobuf:"varint,8,rep,packed,name=packed_ids,json=packedIds,proto3" json:"packed_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SlabBatch) Reset() { + *x = SlabBatch{} + mi := &file_slab_slab_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SlabBatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SlabBatch) ProtoMessage() {} + +func (x *SlabBatch) ProtoReflect() protoreflect.Message { + mi := &file_slab_slab_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SlabBatch.ProtoReflect.Descriptor instead. +func (*SlabBatch) Descriptor() ([]byte, []int) { + return file_slab_slab_proto_rawDescGZIP(), []int{0} +} + +func (x *SlabBatch) GetShard() int64 { + if x != nil && x.Shard != nil { + return *x.Shard + } + return 0 +} + +func (x *SlabBatch) GetItems() []*SlabItem { + if x != nil { + return x.Items + } + return nil +} + +func (x *SlabBatch) GetRanges() []*SlabRange { + if x != nil { + return x.Ranges + } + return nil +} + +func (x *SlabBatch) GetIndex() map[string]*SlabItem { + if x != nil { + return x.Index + } + return nil +} + +func (x *SlabBatch) GetMeta() *SlabMeta { + if x != nil { + return x.Meta + } + return nil +} + +func (x *SlabBatch) GetExtra() isSlabBatch_Extra { + if x != nil { + return x.Extra + } + return nil +} + +func (x *SlabBatch) GetExtraItem() *SlabItem { + if x != nil { + if x, ok := x.Extra.(*SlabBatch_ExtraItem); ok { + return x.ExtraItem + } + } + return nil +} + +func (x *SlabBatch) GetNote() string { + if x != nil { + if x, ok := x.Extra.(*SlabBatch_Note); ok { + return x.Note + } + } + return "" +} + +func (x *SlabBatch) GetPackedIds() []int64 { + if x != nil { + return x.PackedIds + } + return nil +} + +type isSlabBatch_Extra interface { + isSlabBatch_Extra() +} + +type SlabBatch_ExtraItem struct { + ExtraItem *SlabItem `protobuf:"bytes,6,opt,name=extra_item,json=extraItem,proto3,oneof"` +} + +type SlabBatch_Note struct { + Note string `protobuf:"bytes,7,opt,name=note,proto3,oneof"` +} + +func (*SlabBatch_ExtraItem) isSlabBatch_Extra() {} + +func (*SlabBatch_Note) isSlabBatch_Extra() {} + +type SlabItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + ExpectedVersion *int64 `protobuf:"varint,3,opt,name=expected_version,json=expectedVersion,proto3,oneof" json:"expected_version,omitempty"` + ClientIdentity *string `protobuf:"bytes,4,opt,name=client_identity,json=clientIdentity,proto3,oneof" json:"client_identity,omitempty"` + Flag *bool `protobuf:"varint,5,opt,name=flag,proto3,oneof" json:"flag,omitempty"` + Score *float64 `protobuf:"fixed64,6,opt,name=score,proto3,oneof" json:"score,omitempty"` + Stamp *uint64 `protobuf:"fixed64,7,opt,name=stamp,proto3,oneof" json:"stamp,omitempty"` + Flavor *SlabFlavor `protobuf:"varint,8,opt,name=flavor,proto3,enum=SlabFlavor,oneof" json:"flavor,omitempty"` + Meta *SlabMeta `protobuf:"bytes,9,opt,name=meta,proto3" json:"meta,omitempty"` + Children []*SlabItem `protobuf:"bytes,10,rep,name=children,proto3" json:"children,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SlabItem) Reset() { + *x = SlabItem{} + mi := &file_slab_slab_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SlabItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SlabItem) ProtoMessage() {} + +func (x *SlabItem) ProtoReflect() protoreflect.Message { + mi := &file_slab_slab_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SlabItem.ProtoReflect.Descriptor instead. +func (*SlabItem) Descriptor() ([]byte, []int) { + return file_slab_slab_proto_rawDescGZIP(), []int{1} +} + +func (x *SlabItem) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *SlabItem) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *SlabItem) GetExpectedVersion() int64 { + if x != nil && x.ExpectedVersion != nil { + return *x.ExpectedVersion + } + return 0 +} + +func (x *SlabItem) GetClientIdentity() string { + if x != nil && x.ClientIdentity != nil { + return *x.ClientIdentity + } + return "" +} + +func (x *SlabItem) GetFlag() bool { + if x != nil && x.Flag != nil { + return *x.Flag + } + return false +} + +func (x *SlabItem) GetScore() float64 { + if x != nil && x.Score != nil { + return *x.Score + } + return 0 +} + +func (x *SlabItem) GetStamp() uint64 { + if x != nil && x.Stamp != nil { + return *x.Stamp + } + return 0 +} + +func (x *SlabItem) GetFlavor() SlabFlavor { + if x != nil && x.Flavor != nil { + return *x.Flavor + } + return SlabFlavor_SLAB_FLAVOR_UNSPECIFIED +} + +func (x *SlabItem) GetMeta() *SlabMeta { + if x != nil { + return x.Meta + } + return nil +} + +func (x *SlabItem) GetChildren() []*SlabItem { + if x != nil { + return x.Children + } + return nil +} + +type SlabRange struct { + state protoimpl.MessageState `protogen:"open.v1"` + StartInclusive string `protobuf:"bytes,1,opt,name=start_inclusive,json=startInclusive,proto3" json:"start_inclusive,omitempty"` + EndExclusive string `protobuf:"bytes,2,opt,name=end_exclusive,json=endExclusive,proto3" json:"end_exclusive,omitempty"` + Delta *int64 `protobuf:"zigzag64,3,opt,name=delta,proto3,oneof" json:"delta,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SlabRange) Reset() { + *x = SlabRange{} + mi := &file_slab_slab_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SlabRange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SlabRange) ProtoMessage() {} + +func (x *SlabRange) ProtoReflect() protoreflect.Message { + mi := &file_slab_slab_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SlabRange.ProtoReflect.Descriptor instead. +func (*SlabRange) Descriptor() ([]byte, []int) { + return file_slab_slab_proto_rawDescGZIP(), []int{2} +} + +func (x *SlabRange) GetStartInclusive() string { + if x != nil { + return x.StartInclusive + } + return "" +} + +func (x *SlabRange) GetEndExclusive() string { + if x != nil { + return x.EndExclusive + } + return "" +} + +func (x *SlabRange) GetDelta() int64 { + if x != nil && x.Delta != nil { + return *x.Delta + } + return 0 +} + +type SlabMeta struct { + state protoimpl.MessageState `protogen:"open.v1"` + CreatedAt int64 `protobuf:"varint,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Ttl *uint32 `protobuf:"varint,2,opt,name=ttl,proto3,oneof" json:"ttl,omitempty"` + Weight *float32 `protobuf:"fixed32,3,opt,name=weight,proto3,oneof" json:"weight,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SlabMeta) Reset() { + *x = SlabMeta{} + mi := &file_slab_slab_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SlabMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SlabMeta) ProtoMessage() {} + +func (x *SlabMeta) ProtoReflect() protoreflect.Message { + mi := &file_slab_slab_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SlabMeta.ProtoReflect.Descriptor instead. +func (*SlabMeta) Descriptor() ([]byte, []int) { + return file_slab_slab_proto_rawDescGZIP(), []int{3} +} + +func (x *SlabMeta) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *SlabMeta) GetTtl() uint32 { + if x != nil && x.Ttl != nil { + return *x.Ttl + } + return 0 +} + +func (x *SlabMeta) GetWeight() float32 { + if x != nil && x.Weight != nil { + return *x.Weight + } + return 0 +} + +// SlabPlain is not reachable from any slab-enabled message: it must keep +// only the stock unmarshalling methods. +type SlabPlain struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SlabPlain) Reset() { + *x = SlabPlain{} + mi := &file_slab_slab_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SlabPlain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SlabPlain) ProtoMessage() {} + +func (x *SlabPlain) ProtoReflect() protoreflect.Message { + mi := &file_slab_slab_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SlabPlain.ProtoReflect.Descriptor instead. +func (*SlabPlain) Descriptor() ([]byte, []int) { + return file_slab_slab_proto_rawDescGZIP(), []int{4} +} + +func (x *SlabPlain) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_slab_slab_proto protoreflect.FileDescriptor + +const file_slab_slab_proto_rawDesc = "" + + "\n" + + "\x0fslab/slab.proto\x1a3github.com/planetscale/vtprotobuf/vtproto/ext.proto\"\xf6\x02\n" + + "\tSlabBatch\x12\x19\n" + + "\x05shard\x18\x01 \x01(\x03H\x01R\x05shard\x88\x01\x01\x12\x1f\n" + + "\x05items\x18\x02 \x03(\v2\t.SlabItemR\x05items\x12\"\n" + + "\x06ranges\x18\x03 \x03(\v2\n" + + ".SlabRangeR\x06ranges\x12+\n" + + "\x05index\x18\x04 \x03(\v2\x15.SlabBatch.IndexEntryR\x05index\x12\x1d\n" + + "\x04meta\x18\x05 \x01(\v2\t.SlabMetaR\x04meta\x12*\n" + + "\n" + + "extra_item\x18\x06 \x01(\v2\t.SlabItemH\x00R\textraItem\x12\x14\n" + + "\x04note\x18\a \x01(\tH\x00R\x04note\x12\x1d\n" + + "\n" + + "packed_ids\x18\b \x03(\x03R\tpackedIds\x1aC\n" + + "\n" + + "IndexEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x1f\n" + + "\x05value\x18\x02 \x01(\v2\t.SlabItemR\x05value:\x028\x01:\x04\xb8\xa6\x1f\x01B\a\n" + + "\x05extraB\b\n" + + "\x06_shard\"\xa0\x03\n" + + "\bSlabItem\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12.\n" + + "\x10expected_version\x18\x03 \x01(\x03H\x00R\x0fexpectedVersion\x88\x01\x01\x12,\n" + + "\x0fclient_identity\x18\x04 \x01(\tH\x01R\x0eclientIdentity\x88\x01\x01\x12\x17\n" + + "\x04flag\x18\x05 \x01(\bH\x02R\x04flag\x88\x01\x01\x12\x19\n" + + "\x05score\x18\x06 \x01(\x01H\x03R\x05score\x88\x01\x01\x12\x19\n" + + "\x05stamp\x18\a \x01(\x06H\x04R\x05stamp\x88\x01\x01\x12(\n" + + "\x06flavor\x18\b \x01(\x0e2\v.SlabFlavorH\x05R\x06flavor\x88\x01\x01\x12\x1d\n" + + "\x04meta\x18\t \x01(\v2\t.SlabMetaR\x04meta\x12%\n" + + "\bchildren\x18\n" + + " \x03(\v2\t.SlabItemR\bchildrenB\x13\n" + + "\x11_expected_versionB\x12\n" + + "\x10_client_identityB\a\n" + + "\x05_flagB\b\n" + + "\x06_scoreB\b\n" + + "\x06_stampB\t\n" + + "\a_flavor\"~\n" + + "\tSlabRange\x12'\n" + + "\x0fstart_inclusive\x18\x01 \x01(\tR\x0estartInclusive\x12#\n" + + "\rend_exclusive\x18\x02 \x01(\tR\fendExclusive\x12\x19\n" + + "\x05delta\x18\x03 \x01(\x12H\x00R\x05delta\x88\x01\x01B\b\n" + + "\x06_delta\"p\n" + + "\bSlabMeta\x12\x1d\n" + + "\n" + + "created_at\x18\x01 \x01(\x03R\tcreatedAt\x12\x15\n" + + "\x03ttl\x18\x02 \x01(\rH\x00R\x03ttl\x88\x01\x01\x12\x1b\n" + + "\x06weight\x18\x03 \x01(\x02H\x01R\x06weight\x88\x01\x01B\x06\n" + + "\x04_ttlB\t\n" + + "\a_weight\"\x1f\n" + + "\tSlabPlain\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name*V\n" + + "\n" + + "SlabFlavor\x12\x1b\n" + + "\x17SLAB_FLAVOR_UNSPECIFIED\x10\x00\x12\x15\n" + + "\x11SLAB_FLAVOR_SWEET\x10\x01\x12\x14\n" + + "\x10SLAB_FLAVOR_SOUR\x10\x02B\x10Z\x0etestproto/slabb\x06proto3" + +var ( + file_slab_slab_proto_rawDescOnce sync.Once + file_slab_slab_proto_rawDescData []byte +) + +func file_slab_slab_proto_rawDescGZIP() []byte { + file_slab_slab_proto_rawDescOnce.Do(func() { + file_slab_slab_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_slab_slab_proto_rawDesc), len(file_slab_slab_proto_rawDesc))) + }) + return file_slab_slab_proto_rawDescData +} + +var file_slab_slab_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_slab_slab_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_slab_slab_proto_goTypes = []any{ + (SlabFlavor)(0), // 0: SlabFlavor + (*SlabBatch)(nil), // 1: SlabBatch + (*SlabItem)(nil), // 2: SlabItem + (*SlabRange)(nil), // 3: SlabRange + (*SlabMeta)(nil), // 4: SlabMeta + (*SlabPlain)(nil), // 5: SlabPlain + nil, // 6: SlabBatch.IndexEntry +} +var file_slab_slab_proto_depIdxs = []int32{ + 2, // 0: SlabBatch.items:type_name -> SlabItem + 3, // 1: SlabBatch.ranges:type_name -> SlabRange + 6, // 2: SlabBatch.index:type_name -> SlabBatch.IndexEntry + 4, // 3: SlabBatch.meta:type_name -> SlabMeta + 2, // 4: SlabBatch.extra_item:type_name -> SlabItem + 0, // 5: SlabItem.flavor:type_name -> SlabFlavor + 4, // 6: SlabItem.meta:type_name -> SlabMeta + 2, // 7: SlabItem.children:type_name -> SlabItem + 2, // 8: SlabBatch.IndexEntry.value:type_name -> SlabItem + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_slab_slab_proto_init() } +func file_slab_slab_proto_init() { + if File_slab_slab_proto != nil { + return + } + file_slab_slab_proto_msgTypes[0].OneofWrappers = []any{ + (*SlabBatch_ExtraItem)(nil), + (*SlabBatch_Note)(nil), + } + file_slab_slab_proto_msgTypes[1].OneofWrappers = []any{} + file_slab_slab_proto_msgTypes[2].OneofWrappers = []any{} + file_slab_slab_proto_msgTypes[3].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_slab_slab_proto_rawDesc), len(file_slab_slab_proto_rawDesc)), + NumEnums: 1, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_slab_slab_proto_goTypes, + DependencyIndexes: file_slab_slab_proto_depIdxs, + EnumInfos: file_slab_slab_proto_enumTypes, + MessageInfos: file_slab_slab_proto_msgTypes, + }.Build() + File_slab_slab_proto = out.File + file_slab_slab_proto_goTypes = nil + file_slab_slab_proto_depIdxs = nil +} diff --git a/testproto/slab/slab.proto b/testproto/slab/slab.proto new file mode 100644 index 00000000..6638587f --- /dev/null +++ b/testproto/slab/slab.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; +option go_package = "testproto/slab"; + +import "github.com/planetscale/vtprotobuf/vtproto/ext.proto"; + +enum SlabFlavor { + SLAB_FLAVOR_UNSPECIFIED = 0; + SLAB_FLAVOR_SWEET = 1; + SLAB_FLAVOR_SOUR = 2; +} + +message SlabBatch { + option (vtproto.slab) = true; + + optional int64 shard = 1; + repeated SlabItem items = 2; + repeated SlabRange ranges = 3; + map index = 4; + SlabMeta meta = 5; + oneof extra { + SlabItem extra_item = 6; + string note = 7; + } + repeated int64 packed_ids = 8; +} + +message SlabItem { + string key = 1; + bytes value = 2; + optional int64 expected_version = 3; + optional string client_identity = 4; + optional bool flag = 5; + optional double score = 6; + optional fixed64 stamp = 7; + optional SlabFlavor flavor = 8; + SlabMeta meta = 9; + repeated SlabItem children = 10; +} + +message SlabRange { + string start_inclusive = 1; + string end_exclusive = 2; + optional sint64 delta = 3; +} + +message SlabMeta { + int64 created_at = 1; + optional uint32 ttl = 2; + optional float weight = 3; +} + +// SlabPlain is not reachable from any slab-enabled message: it must keep +// only the stock unmarshalling methods. +message SlabPlain { + string name = 1; +} diff --git a/testproto/slab/slab_bench_test.go b/testproto/slab/slab_bench_test.go new file mode 100644 index 00000000..cde87c8a --- /dev/null +++ b/testproto/slab/slab_bench_test.go @@ -0,0 +1,35 @@ +package slab + +import ( + "fmt" + "testing" +) + +func BenchmarkUnmarshal(b *testing.B) { + for _, items := range []int{1, 8, 32, 128} { + data, err := makeBatch(items).MarshalVT() + if err != nil { + b.Fatal(err) + } + b.Run(fmt.Sprintf("stock/items=%d", items), func(b *testing.B) { + b.SetBytes(int64(len(data))) + b.ReportAllocs() + for i := 0; i < b.N; i++ { + m := &SlabBatch{} + if err := m.UnmarshalVT(data); err != nil { + b.Fatal(err) + } + } + }) + b.Run(fmt.Sprintf("slab/items=%d", items), func(b *testing.B) { + b.SetBytes(int64(len(data))) + b.ReportAllocs() + for i := 0; i < b.N; i++ { + m := &SlabBatch{} + if err := m.UnmarshalVTSlab(data); err != nil { + b.Fatal(err) + } + } + }) + } +} diff --git a/testproto/slab/slab_test.go b/testproto/slab/slab_test.go new file mode 100644 index 00000000..6eb683a7 --- /dev/null +++ b/testproto/slab/slab_test.go @@ -0,0 +1,275 @@ +package slab + +import ( + "fmt" + "testing" + + grpccodec "github.com/planetscale/vtprotobuf/codec/grpc" + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" +) + +func ptr[T any](v T) *T { return &v } + +func makeItem(i int, withChildren bool) *SlabItem { + item := &SlabItem{ + Key: fmt.Sprintf("/keys/%016d", i), + Value: []byte(fmt.Sprintf("value payload %d padding padding padding", i)), + Meta: &SlabMeta{CreatedAt: int64(1000 + i)}, + } + // exercise both set and unset presence fields + if i%2 == 0 { + item.ExpectedVersion = ptr(int64(i)) + item.ClientIdentity = ptr(fmt.Sprintf("client-%d", i)) + item.Flag = ptr(i%4 == 0) + item.Score = ptr(float64(i) * 1.5) + } + if i%3 == 0 { + item.Stamp = ptr(uint64(i) << 20) + item.Flavor = ptr(SlabFlavor(i % 3)) + item.Meta.Ttl = ptr(uint32(i)) + item.Meta.Weight = ptr(float32(i) / 3) + } + if withChildren && i%5 == 0 { + item.Children = []*SlabItem{makeItem(10*i+1, false), makeItem(10*i+2, false)} + } + return item +} + +func makeBatch(items int) *SlabBatch { + batch := &SlabBatch{ + Shard: ptr(int64(42)), + Meta: &SlabMeta{CreatedAt: 7, Ttl: ptr(uint32(99))}, + PackedIds: []int64{}, + } + for i := 0; i < items; i++ { + batch.Items = append(batch.Items, makeItem(i, true)) + batch.PackedIds = append(batch.PackedIds, int64(i)*7) + } + for i := 0; i < items/2; i++ { + batch.Ranges = append(batch.Ranges, &SlabRange{ + StartInclusive: fmt.Sprintf("/start/%d", i), + EndExclusive: fmt.Sprintf("/end/%d", i), + Delta: ptr(int64(-i)), + }) + } + if items > 0 { + batch.Index = map[string]*SlabItem{} + for i := 0; i < (items+3)/4; i++ { + batch.Index[fmt.Sprintf("idx-%d", i)] = makeItem(1000+i, false) + } + batch.Extra = &SlabBatch_ExtraItem{ExtraItem: makeItem(9999, false)} + } else { + batch.Extra = &SlabBatch_Note{Note: "empty"} + } + return batch +} + +func TestUnmarshalVTSlabEquivalence(t *testing.T) { + for _, items := range []int{0, 1, 3, 8, 32, 200} { + t.Run(fmt.Sprintf("items=%d", items), func(t *testing.T) { + orig := makeBatch(items) + data, err := orig.MarshalVT() + if err != nil { + t.Fatal(err) + } + + stock := &SlabBatch{} + if err := stock.UnmarshalVT(data); err != nil { + t.Fatal(err) + } + slab := &SlabBatch{} + if err := slab.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + + if !proto.Equal(orig, slab) { + t.Fatalf("slab-decoded message differs from original:\norig: %v\nslab: %v", orig, slab) + } + if !proto.Equal(stock, slab) { + t.Fatalf("slab-decoded message differs from stock-decoded one") + } + }) + } +} + +// Small payloads take the bypass branch and must behave identically. +func TestUnmarshalVTSlabSmallPayloadBypass(t *testing.T) { + orig := &SlabBatch{Shard: ptr(int64(1)), Items: []*SlabItem{{Key: "k", Value: []byte("v")}}} + data, err := orig.MarshalVT() + if err != nil { + t.Fatal(err) + } + if len(data) >= 256 { + t.Fatalf("test payload unexpectedly large: %d bytes", len(data)) + } + slab := &SlabBatch{} + if err := slab.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + if !proto.Equal(orig, slab) { + t.Fatal("bypass path decoded a different message") + } +} + +func TestUnmarshalVTSlabRetainsUnknownFields(t *testing.T) { + data, err := makeBatch(8).MarshalVT() + if err != nil { + t.Fatal(err) + } + // append unknown fields of several wire types + unknown := protowire.AppendTag(nil, 999, protowire.BytesType) + unknown = protowire.AppendBytes(unknown, []byte("unknown payload")) + unknown = protowire.AppendTag(unknown, 1000, protowire.VarintType) + unknown = protowire.AppendVarint(unknown, 12345) + data = append(data, unknown...) + + slab := &SlabBatch{} + if err := slab.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + stock := &SlabBatch{} + if err := stock.UnmarshalVT(data); err != nil { + t.Fatal(err) + } + if !proto.Equal(stock, slab) { + t.Fatal("slab decoding with unknown fields differs from stock") + } + + reData, err := slab.MarshalVT() + if err != nil { + t.Fatal(err) + } + reDecoded := &SlabBatch{} + if err := reDecoded.UnmarshalVT(reData); err != nil { + t.Fatal(err) + } + if !proto.Equal(stock, reDecoded) { + t.Fatal("unknown fields were not retained through a slab decode + re-encode") + } +} + +// The decoded message must not alias the input buffer. +func TestUnmarshalVTSlabNoAliasing(t *testing.T) { + orig := makeBatch(16) + data, err := orig.MarshalVT() + if err != nil { + t.Fatal(err) + } + slab := &SlabBatch{} + if err := slab.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + for i := range data { + data[i] = 0xFF + } + if !proto.Equal(orig, slab) { + t.Fatal("decoded message changed when the source buffer was overwritten") + } +} + +// Unmarshalling into a non-fresh message follows proto merge semantics; +// slab decoding must match stock decoding exactly. +func TestUnmarshalVTSlabMerge(t *testing.T) { + first, err := makeBatch(8).MarshalVT() + if err != nil { + t.Fatal(err) + } + second, err := makeBatch(5).MarshalVT() + if err != nil { + t.Fatal(err) + } + + stock := &SlabBatch{} + slab := &SlabBatch{} + for _, data := range [][]byte{first, second} { + if err := stock.UnmarshalVT(data); err != nil { + t.Fatal(err) + } + if err := slab.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + } + if !proto.Equal(stock, slab) { + t.Fatal("merge semantics differ between stock and slab decoding") + } +} + +// Truncations and corruptions must never panic (this exercises both the +// counting pre-pass and the decode loops on malformed input). +func TestUnmarshalVTSlabMalformedInput(t *testing.T) { + data, err := makeBatch(8).MarshalVT() + if err != nil { + t.Fatal(err) + } + if len(data) < 256 { + t.Fatalf("payload must exceed the bypass threshold, got %d bytes", len(data)) + } + for i := 0; i <= len(data); i++ { + m := &SlabBatch{} + _ = m.UnmarshalVTSlab(data[:i]) // must not panic + } + for i := 0; i < len(data); i++ { + corrupted := append([]byte(nil), data...) + corrupted[i] ^= 0xA5 + m := &SlabBatch{} + _ = m.UnmarshalVTSlab(corrupted) // must not panic + } +} + +// The whole point: slab decoding must allocate substantially less than +// stock decoding on repeated-message-heavy payloads. +func TestUnmarshalVTSlabReducesAllocations(t *testing.T) { + data, err := makeBatch(32).MarshalVT() + if err != nil { + t.Fatal(err) + } + stockAllocs := testing.AllocsPerRun(50, func() { + m := &SlabBatch{} + if err := m.UnmarshalVT(data); err != nil { + t.Fatal(err) + } + }) + slabAllocs := testing.AllocsPerRun(50, func() { + m := &SlabBatch{} + if err := m.UnmarshalVTSlab(data); err != nil { + t.Fatal(err) + } + }) + t.Logf("allocs/op: stock=%v slab=%v", stockAllocs, slabAllocs) + if slabAllocs >= stockAllocs { + t.Fatalf("slab decoding did not reduce allocations: stock=%v slab=%v", stockAllocs, slabAllocs) + } +} + +// The bundled gRPC codec must transparently dispatch to UnmarshalVTSlab for +// opted-in messages and keep using UnmarshalVT for everything else. +func TestGRPCCodecPrefersSlab(t *testing.T) { + var codec grpccodec.Codec + + orig := makeBatch(16) + data, err := codec.Marshal(orig) + if err != nil { + t.Fatal(err) + } + decoded := &SlabBatch{} + if err := codec.Unmarshal(data, decoded); err != nil { + t.Fatal(err) + } + if !proto.Equal(orig, decoded) { + t.Fatal("codec round-trip through the slab entry point lost data") + } + + plain := &SlabPlain{Name: "n"} + plainData, err := codec.Marshal(plain) + if err != nil { + t.Fatal(err) + } + plainDecoded := &SlabPlain{} + if err := codec.Unmarshal(plainData, plainDecoded); err != nil { + t.Fatal(err) + } + if !proto.Equal(plain, plainDecoded) { + t.Fatal("codec round-trip of a non-slab message lost data") + } +} diff --git a/testproto/slab/slab_vtproto.pb.go b/testproto/slab/slab_vtproto.pb.go new file mode 100644 index 00000000..7b7d52ce --- /dev/null +++ b/testproto/slab/slab_vtproto.pb.go @@ -0,0 +1,4692 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: (devel) +// source: slab/slab.proto + +package slab + +import ( + binary "encoding/binary" + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + math "math" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *SlabBatch) CloneVT() *SlabBatch { + if m == nil { + return (*SlabBatch)(nil) + } + r := new(SlabBatch) + r.Meta = m.Meta.CloneVT() + if rhs := m.Shard; rhs != nil { + tmpVal := *rhs + r.Shard = &tmpVal + } + if rhs := m.Items; rhs != nil { + tmpContainer := make([]*SlabItem, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Items = tmpContainer + } + if rhs := m.Ranges; rhs != nil { + tmpContainer := make([]*SlabRange, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Ranges = tmpContainer + } + if rhs := m.Index; rhs != nil { + tmpContainer := make(map[string]*SlabItem, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Index = tmpContainer + } + if m.Extra != nil { + r.Extra = m.Extra.(interface{ CloneVT() isSlabBatch_Extra }).CloneVT() + } + if rhs := m.PackedIds; rhs != nil { + tmpContainer := make([]int64, len(rhs)) + copy(tmpContainer, rhs) + r.PackedIds = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SlabBatch) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *SlabBatch_ExtraItem) CloneVT() isSlabBatch_Extra { + if m == nil { + return (*SlabBatch_ExtraItem)(nil) + } + r := new(SlabBatch_ExtraItem) + r.ExtraItem = m.ExtraItem.CloneVT() + return r +} + +func (m *SlabBatch_Note) CloneVT() isSlabBatch_Extra { + if m == nil { + return (*SlabBatch_Note)(nil) + } + r := new(SlabBatch_Note) + r.Note = m.Note + return r +} + +func (m *SlabItem) CloneVT() *SlabItem { + if m == nil { + return (*SlabItem)(nil) + } + r := new(SlabItem) + r.Key = m.Key + r.Meta = m.Meta.CloneVT() + if rhs := m.Value; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Value = tmpBytes + } + if rhs := m.ExpectedVersion; rhs != nil { + tmpVal := *rhs + r.ExpectedVersion = &tmpVal + } + if rhs := m.ClientIdentity; rhs != nil { + tmpVal := *rhs + r.ClientIdentity = &tmpVal + } + if rhs := m.Flag; rhs != nil { + tmpVal := *rhs + r.Flag = &tmpVal + } + if rhs := m.Score; rhs != nil { + tmpVal := *rhs + r.Score = &tmpVal + } + if rhs := m.Stamp; rhs != nil { + tmpVal := *rhs + r.Stamp = &tmpVal + } + if rhs := m.Flavor; rhs != nil { + tmpVal := *rhs + r.Flavor = &tmpVal + } + if rhs := m.Children; rhs != nil { + tmpContainer := make([]*SlabItem, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Children = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SlabItem) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *SlabRange) CloneVT() *SlabRange { + if m == nil { + return (*SlabRange)(nil) + } + r := new(SlabRange) + r.StartInclusive = m.StartInclusive + r.EndExclusive = m.EndExclusive + if rhs := m.Delta; rhs != nil { + tmpVal := *rhs + r.Delta = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SlabRange) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *SlabMeta) CloneVT() *SlabMeta { + if m == nil { + return (*SlabMeta)(nil) + } + r := new(SlabMeta) + r.CreatedAt = m.CreatedAt + if rhs := m.Ttl; rhs != nil { + tmpVal := *rhs + r.Ttl = &tmpVal + } + if rhs := m.Weight; rhs != nil { + tmpVal := *rhs + r.Weight = &tmpVal + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SlabMeta) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *SlabPlain) CloneVT() *SlabPlain { + if m == nil { + return (*SlabPlain)(nil) + } + r := new(SlabPlain) + r.Name = m.Name + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SlabPlain) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *SlabBatch) EqualVT(that *SlabBatch) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Extra == nil && that.Extra != nil { + return false + } else if this.Extra != nil { + if that.Extra == nil { + return false + } + if !this.Extra.(interface{ EqualVT(isSlabBatch_Extra) bool }).EqualVT(that.Extra) { + return false + } + } + if p, q := this.Shard, that.Shard; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if len(this.Items) != len(that.Items) { + return false + } + for i, vx := range this.Items { + vy := that.Items[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &SlabItem{} + } + if q == nil { + q = &SlabItem{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Ranges) != len(that.Ranges) { + return false + } + for i, vx := range this.Ranges { + vy := that.Ranges[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &SlabRange{} + } + if q == nil { + q = &SlabRange{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Index) != len(that.Index) { + return false + } + for i, vx := range this.Index { + vy, ok := that.Index[i] + if !ok { + return false + } + if p, q := vx, vy; p != q { + if p == nil { + p = &SlabItem{} + } + if q == nil { + q = &SlabItem{} + } + if !p.EqualVT(q) { + return false + } + } + } + if !this.Meta.EqualVT(that.Meta) { + return false + } + if len(this.PackedIds) != len(that.PackedIds) { + return false + } + for i, vx := range this.PackedIds { + vy := that.PackedIds[i] + if vx != vy { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SlabBatch) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*SlabBatch) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SlabBatch_ExtraItem) EqualVT(thatIface isSlabBatch_Extra) bool { + that, ok := thatIface.(*SlabBatch_ExtraItem) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.ExtraItem, that.ExtraItem; p != q { + if p == nil { + p = &SlabItem{} + } + if q == nil { + q = &SlabItem{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *SlabBatch_Note) EqualVT(thatIface isSlabBatch_Extra) bool { + that, ok := thatIface.(*SlabBatch_Note) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.Note != that.Note { + return false + } + return true +} + +func (this *SlabItem) EqualVT(that *SlabItem) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Key != that.Key { + return false + } + if string(this.Value) != string(that.Value) { + return false + } + if p, q := this.ExpectedVersion, that.ExpectedVersion; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.ClientIdentity, that.ClientIdentity; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Flag, that.Flag; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Score, that.Score; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Stamp, that.Stamp; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Flavor, that.Flavor; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if !this.Meta.EqualVT(that.Meta) { + return false + } + if len(this.Children) != len(that.Children) { + return false + } + for i, vx := range this.Children { + vy := that.Children[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &SlabItem{} + } + if q == nil { + q = &SlabItem{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SlabItem) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*SlabItem) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SlabRange) EqualVT(that *SlabRange) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.StartInclusive != that.StartInclusive { + return false + } + if this.EndExclusive != that.EndExclusive { + return false + } + if p, q := this.Delta, that.Delta; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SlabRange) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*SlabRange) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SlabMeta) EqualVT(that *SlabMeta) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.CreatedAt != that.CreatedAt { + return false + } + if p, q := this.Ttl, that.Ttl; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + if p, q := this.Weight, that.Weight; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SlabMeta) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*SlabMeta) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SlabPlain) EqualVT(that *SlabPlain) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SlabPlain) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*SlabPlain) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *SlabBatch) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabBatch) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabBatch) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Extra.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if len(m.PackedIds) > 0 { + var pksize2 int + for _, num := range m.PackedIds { + pksize2 += protohelpers.SizeOfVarint(uint64(num)) + } + i -= pksize2 + j1 := i + for _, num1 := range m.PackedIds { + num := uint64(num1) + for num >= 1<<7 { + dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA[j1] = uint8(num) + j1++ + } + i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize2)) + i-- + dAtA[i] = 0x42 + } + if m.Meta != nil { + size, err := m.Meta.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + if len(m.Index) > 0 { + for k := range m.Index { + v := m.Index[k] + baseI := i + size, err := v.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if len(m.Ranges) > 0 { + for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Ranges[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Items[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if m.Shard != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Shard)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SlabBatch_ExtraItem) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabBatch_ExtraItem) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ExtraItem != nil { + size, err := m.ExtraItem.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } else { + i = protohelpers.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *SlabBatch_Note) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabBatch_Note) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Note) + copy(dAtA[i:], m.Note) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Note))) + i-- + dAtA[i] = 0x3a + return len(dAtA) - i, nil +} +func (m *SlabItem) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabItem) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabItem) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Children) > 0 { + for iNdEx := len(m.Children) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Children[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x52 + } + } + if m.Meta != nil { + size, err := m.Meta.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x4a + } + if m.Flavor != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Flavor)) + i-- + dAtA[i] = 0x40 + } + if m.Stamp != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(*m.Stamp)) + i-- + dAtA[i] = 0x39 + } + if m.Score != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Score)))) + i-- + dAtA[i] = 0x31 + } + if m.Flag != nil { + i-- + if *m.Flag { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.ClientIdentity != nil { + i -= len(*m.ClientIdentity) + copy(dAtA[i:], *m.ClientIdentity) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.ClientIdentity))) + i-- + dAtA[i] = 0x22 + } + if m.ExpectedVersion != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.ExpectedVersion)) + i-- + dAtA[i] = 0x18 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlabRange) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabRange) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabRange) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Delta != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64((uint64(*m.Delta)<<1)^uint64((*m.Delta>>63)))) + i-- + dAtA[i] = 0x18 + } + if len(m.EndExclusive) > 0 { + i -= len(m.EndExclusive) + copy(dAtA[i:], m.EndExclusive) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.EndExclusive))) + i-- + dAtA[i] = 0x12 + } + if len(m.StartInclusive) > 0 { + i -= len(m.StartInclusive) + copy(dAtA[i:], m.StartInclusive) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.StartInclusive))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlabMeta) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabMeta) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Weight != nil { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(*m.Weight)))) + i-- + dAtA[i] = 0x1d + } + if m.Ttl != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Ttl)) + i-- + dAtA[i] = 0x10 + } + if m.CreatedAt != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CreatedAt)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SlabPlain) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabPlain) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SlabPlain) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlabBatch) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabBatch) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabBatch) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.PackedIds) > 0 { + var pksize2 int + for _, num := range m.PackedIds { + pksize2 += protohelpers.SizeOfVarint(uint64(num)) + } + i -= pksize2 + j1 := i + for _, num1 := range m.PackedIds { + num := uint64(num1) + for num >= 1<<7 { + dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA[j1] = uint8(num) + j1++ + } + i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize2)) + i-- + dAtA[i] = 0x42 + } + if msg, ok := m.Extra.(*SlabBatch_Note); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if msg, ok := m.Extra.(*SlabBatch_ExtraItem); ok { + size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if m.Meta != nil { + size, err := m.Meta.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + if len(m.Index) > 0 { + for k := range m.Index { + v := m.Index[k] + baseI := i + size, err := v.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if len(m.Ranges) > 0 { + for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Ranges[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Items[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if m.Shard != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Shard)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SlabBatch_ExtraItem) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabBatch_ExtraItem) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ExtraItem != nil { + size, err := m.ExtraItem.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } else { + i = protohelpers.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *SlabBatch_Note) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabBatch_Note) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Note) + copy(dAtA[i:], m.Note) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Note))) + i-- + dAtA[i] = 0x3a + return len(dAtA) - i, nil +} +func (m *SlabItem) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabItem) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabItem) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Children) > 0 { + for iNdEx := len(m.Children) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Children[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x52 + } + } + if m.Meta != nil { + size, err := m.Meta.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x4a + } + if m.Flavor != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Flavor)) + i-- + dAtA[i] = 0x40 + } + if m.Stamp != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(*m.Stamp)) + i-- + dAtA[i] = 0x39 + } + if m.Score != nil { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.Score)))) + i-- + dAtA[i] = 0x31 + } + if m.Flag != nil { + i-- + if *m.Flag { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.ClientIdentity != nil { + i -= len(*m.ClientIdentity) + copy(dAtA[i:], *m.ClientIdentity) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.ClientIdentity))) + i-- + dAtA[i] = 0x22 + } + if m.ExpectedVersion != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.ExpectedVersion)) + i-- + dAtA[i] = 0x18 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlabRange) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabRange) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabRange) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Delta != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64((uint64(*m.Delta)<<1)^uint64((*m.Delta>>63)))) + i-- + dAtA[i] = 0x18 + } + if len(m.EndExclusive) > 0 { + i -= len(m.EndExclusive) + copy(dAtA[i:], m.EndExclusive) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.EndExclusive))) + i-- + dAtA[i] = 0x12 + } + if len(m.StartInclusive) > 0 { + i -= len(m.StartInclusive) + copy(dAtA[i:], m.StartInclusive) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.StartInclusive))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlabMeta) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabMeta) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabMeta) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Weight != nil { + i -= 4 + binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(*m.Weight)))) + i-- + dAtA[i] = 0x1d + } + if m.Ttl != nil { + i = protohelpers.EncodeVarint(dAtA, i, uint64(*m.Ttl)) + i-- + dAtA[i] = 0x10 + } + if m.CreatedAt != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CreatedAt)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SlabPlain) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlabPlain) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *SlabPlain) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlabBatch) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Shard != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Shard)) + } + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if len(m.Ranges) > 0 { + for _, e := range m.Ranges { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + if len(m.Index) > 0 { + for k, v := range m.Index { + _ = k + _ = v + l = 0 + if v != nil { + l = v.SizeVT() + } + l += 1 + protohelpers.SizeOfVarint(uint64(l)) + mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) + } + } + if m.Meta != nil { + l = m.Meta.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if vtmsg, ok := m.Extra.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + if len(m.PackedIds) > 0 { + l = 0 + for _, e := range m.PackedIds { + l += protohelpers.SizeOfVarint(uint64(e)) + } + n += 1 + protohelpers.SizeOfVarint(uint64(l)) + l + } + n += len(m.unknownFields) + return n +} + +func (m *SlabBatch_ExtraItem) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExtraItem != nil { + l = m.ExtraItem.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *SlabBatch_Note) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Note) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + return n +} +func (m *SlabItem) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.ExpectedVersion != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.ExpectedVersion)) + } + if m.ClientIdentity != nil { + l = len(*m.ClientIdentity) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Flag != nil { + n += 2 + } + if m.Score != nil { + n += 9 + } + if m.Stamp != nil { + n += 9 + } + if m.Flavor != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Flavor)) + } + if m.Meta != nil { + l = m.Meta.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if len(m.Children) > 0 { + for _, e := range m.Children { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *SlabRange) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StartInclusive) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.EndExclusive) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Delta != nil { + n += 1 + protohelpers.SizeOfZigzag(uint64(*m.Delta)) + } + n += len(m.unknownFields) + return n +} + +func (m *SlabMeta) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreatedAt != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.CreatedAt)) + } + if m.Ttl != nil { + n += 1 + protohelpers.SizeOfVarint(uint64(*m.Ttl)) + } + if m.Weight != nil { + n += 5 + } + n += len(m.unknownFields) + return n +} + +func (m *SlabPlain) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SlabBatch) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabBatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabBatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Shard", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Shard = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &SlabItem{}) + if err := m.Items[len(m.Items)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, &SlabRange{}) + if err := m.Ranges[len(m.Ranges)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Index == nil { + m.Index = make(map[string]*SlabItem) + } + var mapkey string + var mapvalue *SlabItem + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protohelpers.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &SlabItem{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Index[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = &SlabMeta{} + } + if err := m.Meta.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraItem", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Extra.(*SlabBatch_ExtraItem); ok { + if err := oneof.ExtraItem.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &SlabItem{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Extra = &SlabBatch_ExtraItem{ExtraItem: v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Note", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Extra = &SlabBatch_Note{Note: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 8: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedIds = append(m.PackedIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedIds) == 0 { + m.PackedIds = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedIds = append(m.PackedIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabItem) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpectedVersion", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ExpectedVersion = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientIdentity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ClientIdentity = &s + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Flag", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Flag = &b + case 6: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Score", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Score = &v2 + case 7: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Stamp", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Stamp = &v + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Flavor", wireType) + } + var v SlabFlavor + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= SlabFlavor(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Flavor = &v + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = &SlabMeta{} + } + if err := m.Meta.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Children", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Children = append(m.Children, &SlabItem{}) + if err := m.Children[len(m.Children)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabRange) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartInclusive", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartInclusive = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndExclusive", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndExclusive = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Delta", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.Delta = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabMeta) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Ttl = &v + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.Weight = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabPlain) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabPlain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabPlain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +// slabArena_slab_slab_proto holds the slabs backing the UnmarshalVTSlab entry +// points of this file. One arena lives for the duration of a single +// top-level unmarshal call. +type slabArena_slab_slab_proto struct { + f_int64 protohelpers.Slab[int64] + f_SlabItem protohelpers.Slab[SlabItem] + f_SlabRange protohelpers.Slab[SlabRange] + f_SlabMeta protohelpers.Slab[SlabMeta] + f_string protohelpers.Slab[string] + f_bool protohelpers.Slab[bool] + f_float64 protohelpers.Slab[float64] + f_uint64 protohelpers.Slab[uint64] + f_SlabFlavor protohelpers.Slab[SlabFlavor] + f_uint32 protohelpers.Slab[uint32] + f_float32 protohelpers.Slab[float32] +} + +// UnmarshalVTSlab is like UnmarshalVT, but allocates nested message +// elements and scalar presence pointers from chunked slabs sized by a +// counting pre-pass over the wire format. Retaining any pointer into +// the decoded message pins that pointer's whole chunk in memory: use +// it for messages whose lifetime ends with the RPC that carried them. +func (m *SlabBatch) UnmarshalVTSlab(dAtA []byte) error { + if len(dAtA) < protohelpers.SlabUnmarshalThreshold { + return m.UnmarshalVT(dAtA) + } + var a slabArena_slab_slab_proto + fieldNums := [3]int32{2, 3, 4} + var counts [3]int + protohelpers.CountFields(dAtA, fieldNums[:], counts[:]) + if counts[0]+counts[1]+counts[2] < protohelpers.SlabUnmarshalMinCount { + return m.UnmarshalVT(dAtA) + } + a.f_SlabItem.Reserve(counts[0] + counts[2]) + a.f_SlabRange.Reserve(counts[1]) + a.f_SlabMeta.Reserve(1 + counts[0] + counts[2]) + return m.unmarshalVTSlab(dAtA, &a) +} + +func (m *SlabBatch) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_slab_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabBatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabBatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Shard", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Shard = a.f_int64.NextValue(v) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, a.f_SlabItem.Next()) + if err := m.Items[len(m.Items)-1].unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, a.f_SlabRange.Next()) + if err := m.Ranges[len(m.Ranges)-1].unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Index == nil { + m.Index = make(map[string]*SlabItem) + } + var mapkey string + var mapvalue *SlabItem + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protohelpers.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = a.f_SlabItem.Next() + if err := mapvalue.unmarshalVTSlab(dAtA[iNdEx:postmsgIndex], a); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Index[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = a.f_SlabMeta.Next() + } + if err := m.Meta.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraItem", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Extra.(*SlabBatch_ExtraItem); ok { + if err := oneof.ExtraItem.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + } else { + v := a.f_SlabItem.Next() + if err := v.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + m.Extra = &SlabBatch_ExtraItem{ExtraItem: v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Note", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Extra = &SlabBatch_Note{Note: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 8: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedIds = append(m.PackedIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedIds) == 0 { + m.PackedIds = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedIds = append(m.PackedIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabItem) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_slab_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpectedVersion", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ExpectedVersion = a.f_int64.NextValue(v) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientIdentity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientIdentity = a.f_string.NextValue(string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Flag", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Flag = a.f_bool.NextValue(bool(v != 0)) + case 6: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Score", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Score = a.f_float64.NextValue(float64(math.Float64frombits(v))) + case 7: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Stamp", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Stamp = a.f_uint64.NextValue(v) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Flavor", wireType) + } + var v SlabFlavor + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= SlabFlavor(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Flavor = a.f_SlabFlavor.NextValue(v) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = a.f_SlabMeta.Next() + } + if err := m.Meta.unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Children", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Children = append(m.Children, a.f_SlabItem.Next()) + if err := m.Children[len(m.Children)-1].unmarshalVTSlab(dAtA[iNdEx:postIndex], a); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabRange) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_slab_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartInclusive", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartInclusive = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndExclusive", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndExclusive = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Delta", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + m.Delta = a.f_int64.NextValue(int64(v)) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabMeta) unmarshalVTSlab(dAtA []byte, a *slabArena_slab_slab_proto) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Ttl = a.f_uint32.NextValue(v) + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.Weight = a.f_float32.NextValue(float32(math.Float32frombits(v))) + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabBatch) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabBatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabBatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Shard", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Shard = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &SlabItem{}) + if err := m.Items[len(m.Items)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, &SlabRange{}) + if err := m.Ranges[len(m.Ranges)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Index == nil { + m.Index = make(map[string]*SlabItem) + } + var mapkey string + var mapvalue *SlabItem + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapkey == 0 { + mapkey = "" + } else { + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) + } + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protohelpers.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &SlabItem{} + if err := mapvalue.UnmarshalVTUnsafe(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Index[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = &SlabMeta{} + } + if err := m.Meta.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraItem", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Extra.(*SlabBatch_ExtraItem); ok { + if err := oneof.ExtraItem.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &SlabItem{} + if err := v.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Extra = &SlabBatch_ExtraItem{ExtraItem: v} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Note", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Extra = &SlabBatch_Note{Note: stringValue} + iNdEx = postIndex + case 8: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedIds = append(m.PackedIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PackedIds) == 0 { + m.PackedIds = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PackedIds = append(m.PackedIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PackedIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabItem) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Key = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = dAtA[iNdEx:postIndex] + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpectedVersion", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ExpectedVersion = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientIdentity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + s := stringValue + m.ClientIdentity = &s + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Flag", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Flag = &b + case 6: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Score", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.Score = &v2 + case 7: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Stamp", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Stamp = &v + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Flavor", wireType) + } + var v SlabFlavor + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= SlabFlavor(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Flavor = &v + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = &SlabMeta{} + } + if err := m.Meta.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Children", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Children = append(m.Children, &SlabItem{}) + if err := m.Children[len(m.Children)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabRange) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartInclusive", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.StartInclusive = stringValue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndExclusive", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.EndExclusive = stringValue + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Delta", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) + v2 := int64(v) + m.Delta = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabMeta) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Ttl = &v + case 3: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.Weight = &v2 + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlabPlain) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlabPlain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlabPlain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Name = stringValue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/vtproto/ext.pb.go b/vtproto/ext.pb.go index 356498dc..4b7a294b 100644 --- a/vtproto/ext.pb.go +++ b/vtproto/ext.pb.go @@ -85,6 +85,14 @@ var file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_extTypes = []protoi Tag: "varint,64102,opt,name=ignore_unknown_fields", Filename: "github.com/planetscale/vtprotobuf/vtproto/ext.proto", }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64103, + Name: "vtproto.slab", + Tag: "varint,64103,opt,name=slab", + Filename: "github.com/planetscale/vtprotobuf/vtproto/ext.proto", + }, { ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*Opts)(nil), @@ -101,12 +109,14 @@ var ( E_Mempool = &file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_extTypes[0] // optional bool ignore_unknown_fields = 64102; E_IgnoreUnknownFields = &file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_extTypes[1] + // optional bool slab = 64103; + E_Slab = &file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_extTypes[2] ) // Extension fields to descriptorpb.FieldOptions. var ( // optional vtproto.Opts options = 64150; - E_Options = &file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_extTypes[2] + E_Options = &file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_extTypes[3] ) var File_github_com_planetscale_vtprotobuf_vtproto_ext_proto protoreflect.FileDescriptor @@ -117,7 +127,8 @@ const file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_rawDesc = "" + "\x04Opts\x12\x16\n" + "\x06unique\x18\x01 \x01(\bR\x06unique:;\n" + "\amempool\x12\x1f.google.protobuf.MessageOptions\x18\xe5\xf4\x03 \x01(\bR\amempool:U\n" + - "\x15ignore_unknown_fields\x12\x1f.google.protobuf.MessageOptions\x18\xe6\xf4\x03 \x01(\bR\x13ignoreUnknownFields:H\n" + + "\x15ignore_unknown_fields\x12\x1f.google.protobuf.MessageOptions\x18\xe6\xf4\x03 \x01(\bR\x13ignoreUnknownFields:5\n" + + "\x04slab\x12\x1f.google.protobuf.MessageOptions\x18\xe7\xf4\x03 \x01(\bR\x04slab:H\n" + "\aoptions\x12\x1d.google.protobuf.FieldOptions\x18\x96\xf5\x03 \x01(\v2\r.vtproto.OptsR\aoptionsBI\n" + "\x13com.google.protobufB\aVTProtoZ)github.com/planetscale/vtprotobuf/vtproto" @@ -142,12 +153,13 @@ var file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_goTypes = []any{ var file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_depIdxs = []int32{ 1, // 0: vtproto.mempool:extendee -> google.protobuf.MessageOptions 1, // 1: vtproto.ignore_unknown_fields:extendee -> google.protobuf.MessageOptions - 2, // 2: vtproto.options:extendee -> google.protobuf.FieldOptions - 0, // 3: vtproto.options:type_name -> vtproto.Opts - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 3, // [3:4] is the sub-list for extension type_name - 0, // [0:3] is the sub-list for extension extendee + 1, // 2: vtproto.slab:extendee -> google.protobuf.MessageOptions + 2, // 3: vtproto.options:extendee -> google.protobuf.FieldOptions + 0, // 4: vtproto.options:type_name -> vtproto.Opts + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 4, // [4:5] is the sub-list for extension type_name + 0, // [0:4] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -163,7 +175,7 @@ func file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_init() { RawDescriptor: unsafe.Slice(unsafe.StringData(file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_rawDesc), len(file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_rawDesc)), NumEnums: 0, NumMessages: 1, - NumExtensions: 3, + NumExtensions: 4, NumServices: 0, }, GoTypes: file_github_com_planetscale_vtprotobuf_vtproto_ext_proto_goTypes,