[#111] protogen: Emit slice of messages without a pointer
All checks were successful
DCO action / DCO (pull_request) Successful in 41s
Tests and linters / Tests (1.22) (pull_request) Successful in 55s
Tests and linters / Tests (1.23) (pull_request) Successful in 57s
Tests and linters / Tests with -race (pull_request) Successful in 1m8s
Tests and linters / Lint (pull_request) Successful in 2m12s

```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
                                              │      old      │                 new                  │
                                              │    sec/op     │    sec/op     vs base                │
ObjectIDSlice/0_elements/to_grpc_message-8       3.193n ±  2%   3.242n ±  0%   +1.50% (p=0.034 n=10)
ObjectIDSlice/0_elements/from_grpc_message-8     3.197n ±  2%   3.343n ±  1%   +4.57% (p=0.000 n=10)
ObjectIDSlice/0_elements/marshal-8               5.666n ±  3%   5.642n ±  0%   -0.42% (p=0.000 n=10)
ObjectIDSlice/1_elements/to_grpc_message-8       53.10n ±  6%   29.78n ± 12%  -43.92% (p=0.000 n=10)
ObjectIDSlice/1_elements/from_grpc_message-8     28.99n ±  5%   29.77n ±  7%        ~ (p=0.165 n=10)
ObjectIDSlice/1_elements/marshal-8               49.08n ±  7%   50.72n ±  6%        ~ (p=0.218 n=10)
ObjectIDSlice/50_elements/to_grpc_message-8     1652.5n ±  7%   277.2n ±  1%  -83.22% (p=0.000 n=10)
ObjectIDSlice/50_elements/from_grpc_message-8    261.2n ± 11%   226.7n ± 15%  -13.19% (p=0.003 n=10)
ObjectIDSlice/50_elements/marshal-8              1.512µ ±  6%   1.514µ ±  6%        ~ (p=0.955 n=10)
geomean                                          52.15n         39.99n        -23.31%

                                              │      old       │                  new                   │
                                              │      B/op      │     B/op      vs base                  │
ObjectIDSlice/0_elements/to_grpc_message-8        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/from_grpc_message-8      0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/marshal-8                0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/to_grpc_message-8        32.00 ± 0%       24.00 ± 0%  -25.00% (p=0.000 n=10)
ObjectIDSlice/1_elements/from_grpc_message-8      24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/marshal-8                48.00 ± 0%       48.00 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/to_grpc_message-8     1.578Ki ± 0%     1.250Ki ± 0%  -20.79% (p=0.000 n=10)
ObjectIDSlice/50_elements/from_grpc_message-8   1.250Ki ± 0%     1.250Ki ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/marshal-8             2.000Ki ± 0%     2.000Ki ± 0%        ~ (p=1.000 n=10) ¹
geomean                                                      ²                  -5.62%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                              │      old      │                 new                  │
                                              │   allocs/op   │ allocs/op   vs base                  │
ObjectIDSlice/0_elements/to_grpc_message-8       0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/from_grpc_message-8     0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/0_elements/marshal-8               0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/to_grpc_message-8       2.000 ± 0%     1.000 ± 0%  -50.00% (p=0.000 n=10)
ObjectIDSlice/1_elements/from_grpc_message-8     1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/1_elements/marshal-8               1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/to_grpc_message-8     51.000 ± 0%     1.000 ± 0%  -98.04% (p=0.000 n=10)
ObjectIDSlice/50_elements/from_grpc_message-8    1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
ObjectIDSlice/50_elements/marshal-8              1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=10) ¹
geomean                                                     ²               -40.18%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-08-27 15:12:31 +03:00
parent a2025376fc
commit 5e1c6a908f
26 changed files with 461 additions and 547 deletions

View file

@ -187,28 +187,26 @@ func (f *HeaderFilter) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []*acl.EACLRecord_Filter) { func HeaderFiltersToGRPC(fs []HeaderFilter) (res []acl.EACLRecord_Filter) {
if fs != nil { if fs != nil {
res = make([]*acl.EACLRecord_Filter, 0, len(fs)) res = make([]acl.EACLRecord_Filter, 0, len(fs))
for i := range fs { for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter)) res = append(res, *fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
} }
} }
return return
} }
func HeaderFiltersFromGRPC(fs []*acl.EACLRecord_Filter) (res []HeaderFilter, err error) { func HeaderFiltersFromGRPC(fs []acl.EACLRecord_Filter) (res []HeaderFilter, err error) {
if fs != nil { if fs != nil {
res = make([]HeaderFilter, len(fs)) res = make([]HeaderFilter, len(fs))
for i := range fs { for i := range fs {
if fs[i] != nil { err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -241,28 +239,26 @@ func (t *Target) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func TargetsToGRPC(ts []Target) (res []*acl.EACLRecord_Target) { func TargetsToGRPC(ts []Target) (res []acl.EACLRecord_Target) {
if ts != nil { if ts != nil {
res = make([]*acl.EACLRecord_Target, 0, len(ts)) res = make([]acl.EACLRecord_Target, 0, len(ts))
for i := range ts { for i := range ts {
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord_Target)) res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
} }
} }
return return
} }
func TargetsFromGRPC(fs []*acl.EACLRecord_Target) (res []Target, err error) { func TargetsFromGRPC(fs []acl.EACLRecord_Target) (res []Target, err error) {
if fs != nil { if fs != nil {
res = make([]Target, len(fs)) res = make([]Target, len(fs))
for i := range fs { for i := range fs {
if fs[i] != nil { err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -309,28 +305,26 @@ func (r *Record) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func RecordsToGRPC(ts []Record) (res []*acl.EACLRecord) { func RecordsToGRPC(ts []Record) (res []acl.EACLRecord) {
if ts != nil { if ts != nil {
res = make([]*acl.EACLRecord, 0, len(ts)) res = make([]acl.EACLRecord, 0, len(ts))
for i := range ts { for i := range ts {
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord)) res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord))
} }
} }
return return
} }
func RecordsFromGRPC(fs []*acl.EACLRecord) (res []Record, err error) { func RecordsFromGRPC(fs []acl.EACLRecord) (res []Record, err error) {
if fs != nil { if fs != nil {
res = make([]Record, len(fs)) res = make([]Record, len(fs))
for i := range fs { for i := range fs {
if fs[i] != nil { err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -429,9 +423,9 @@ func (c *APEOverride) ToGRPCMessage() grpc.Message {
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
if len(c.chains) > 0 { if len(c.chains) > 0 {
apeChains := make([]*apeGRPC.Chain, len(c.chains)) apeChains := make([]apeGRPC.Chain, len(c.chains))
for i := range c.chains { for i := range c.chains {
apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain) apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
} }
m.SetChains(apeChains) m.SetChains(apeChains)
} }
@ -459,7 +453,7 @@ func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
c.chains = make([]*ape.Chain, len(apeChains)) c.chains = make([]*ape.Chain, len(apeChains))
for i := range apeChains { for i := range apeChains {
c.chains[i] = new(ape.Chain) c.chains[i] = new(ape.Chain)
if err := c.chains[i].FromGRPCMessage(apeChains[i]); err != nil { if err := c.chains[i].FromGRPCMessage(&apeChains[i]); err != nil {
return err return err
} }
} }

View file

@ -657,10 +657,10 @@ func (x *EACLRecord_Target) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type EACLRecord struct { type EACLRecord struct {
Operation Operation `json:"operation"` Operation Operation `json:"operation"`
Action Action `json:"action"` Action Action `json:"action"`
Filters []*EACLRecord_Filter `json:"filters"` Filters []EACLRecord_Filter `json:"filters"`
Targets []*EACLRecord_Target `json:"targets"` Targets []EACLRecord_Target `json:"targets"`
} }
var ( var (
@ -680,10 +680,10 @@ func (x *EACLRecord) StableSize() (size int) {
size += proto.EnumSize(1, int32(x.Operation)) size += proto.EnumSize(1, int32(x.Operation))
size += proto.EnumSize(2, int32(x.Action)) size += proto.EnumSize(2, int32(x.Action))
for i := range x.Filters { for i := range x.Filters {
size += proto.NestedStructureSize(3, x.Filters[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Filters[i])
} }
for i := range x.Targets { for i := range x.Targets {
size += proto.NestedStructureSize(4, x.Targets[i]) size += proto.NestedStructureSizeUnchecked(4, &x.Targets[i])
} }
return size return size
} }
@ -708,14 +708,10 @@ func (x *EACLRecord) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendInt32(2, int32(x.Action)) mm.AppendInt32(2, int32(x.Action))
} }
for i := range x.Filters { for i := range x.Filters {
if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
for i := range x.Targets { for i := range x.Targets {
if x.Targets[i] != nil { x.Targets[i].EmitProtobuf(mm.AppendMessage(4))
x.Targets[i].EmitProtobuf(mm.AppendMessage(4))
}
} }
} }
@ -745,8 +741,8 @@ func (x *EACLRecord) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Filters") return fmt.Errorf("cannot unmarshal field %s", "Filters")
} }
x.Filters = append(x.Filters, new(EACLRecord_Filter)) x.Filters = append(x.Filters, EACLRecord_Filter{})
ff := x.Filters[len(x.Filters)-1] ff := &x.Filters[len(x.Filters)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -755,8 +751,8 @@ func (x *EACLRecord) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Targets") return fmt.Errorf("cannot unmarshal field %s", "Targets")
} }
x.Targets = append(x.Targets, new(EACLRecord_Target)) x.Targets = append(x.Targets, EACLRecord_Target{})
ff := x.Targets[len(x.Targets)-1] ff := &x.Targets[len(x.Targets)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -782,22 +778,22 @@ func (x *EACLRecord) GetAction() Action {
func (x *EACLRecord) SetAction(v Action) { func (x *EACLRecord) SetAction(v Action) {
x.Action = v x.Action = v
} }
func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { func (x *EACLRecord) GetFilters() []EACLRecord_Filter {
if x != nil { if x != nil {
return x.Filters return x.Filters
} }
return nil return nil
} }
func (x *EACLRecord) SetFilters(v []*EACLRecord_Filter) { func (x *EACLRecord) SetFilters(v []EACLRecord_Filter) {
x.Filters = v x.Filters = v
} }
func (x *EACLRecord) GetTargets() []*EACLRecord_Target { func (x *EACLRecord) GetTargets() []EACLRecord_Target {
if x != nil { if x != nil {
return x.Targets return x.Targets
} }
return nil return nil
} }
func (x *EACLRecord) SetTargets(v []*EACLRecord_Target) { func (x *EACLRecord) SetTargets(v []EACLRecord_Target) {
x.Targets = v x.Targets = v
} }
@ -921,11 +917,11 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "filters": case "filters":
{ {
var f *EACLRecord_Filter var f EACLRecord_Filter
var list []*EACLRecord_Filter var list []EACLRecord_Filter
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(EACLRecord_Filter) f = EACLRecord_Filter{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -935,11 +931,11 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "targets": case "targets":
{ {
var f *EACLRecord_Target var f EACLRecord_Target
var list []*EACLRecord_Target var list []EACLRecord_Target
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(EACLRecord_Target) f = EACLRecord_Target{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -959,7 +955,7 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) {
type EACLTable struct { type EACLTable struct {
Version *grpc.Version `json:"version"` Version *grpc.Version `json:"version"`
ContainerId *grpc.ContainerID `json:"containerID"` ContainerId *grpc.ContainerID `json:"containerID"`
Records []*EACLRecord `json:"records"` Records []EACLRecord `json:"records"`
} }
var ( var (
@ -979,7 +975,7 @@ func (x *EACLTable) StableSize() (size int) {
size += proto.NestedStructureSize(1, x.Version) size += proto.NestedStructureSize(1, x.Version)
size += proto.NestedStructureSize(2, x.ContainerId) size += proto.NestedStructureSize(2, x.ContainerId)
for i := range x.Records { for i := range x.Records {
size += proto.NestedStructureSize(3, x.Records[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Records[i])
} }
return size return size
} }
@ -1004,9 +1000,7 @@ func (x *EACLTable) EmitProtobuf(mm *easyproto.MessageMarshaler) {
x.ContainerId.EmitProtobuf(mm.AppendMessage(2)) x.ContainerId.EmitProtobuf(mm.AppendMessage(2))
} }
for i := range x.Records { for i := range x.Records {
if x.Records[i] != nil { x.Records[i].EmitProtobuf(mm.AppendMessage(3))
x.Records[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
} }
@ -1042,8 +1036,8 @@ func (x *EACLTable) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Records") return fmt.Errorf("cannot unmarshal field %s", "Records")
} }
x.Records = append(x.Records, new(EACLRecord)) x.Records = append(x.Records, EACLRecord{})
ff := x.Records[len(x.Records)-1] ff := &x.Records[len(x.Records)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1069,13 +1063,13 @@ func (x *EACLTable) GetContainerId() *grpc.ContainerID {
func (x *EACLTable) SetContainerId(v *grpc.ContainerID) { func (x *EACLTable) SetContainerId(v *grpc.ContainerID) {
x.ContainerId = v x.ContainerId = v
} }
func (x *EACLTable) GetRecords() []*EACLRecord { func (x *EACLTable) GetRecords() []EACLRecord {
if x != nil { if x != nil {
return x.Records return x.Records
} }
return nil return nil
} }
func (x *EACLTable) SetRecords(v []*EACLRecord) { func (x *EACLTable) SetRecords(v []EACLRecord) {
x.Records = v x.Records = v
} }
@ -1157,11 +1151,11 @@ func (x *EACLTable) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "records": case "records":
{ {
var f *EACLRecord var f EACLRecord
var list []*EACLRecord var list []EACLRecord
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(EACLRecord) f = EACLRecord{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1371,7 +1365,7 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
type BearerToken_Body_APEOverride struct { type BearerToken_Body_APEOverride struct {
Target *grpc1.ChainTarget `json:"target"` Target *grpc1.ChainTarget `json:"target"`
Chains []*grpc1.Chain `json:"chains"` Chains []grpc1.Chain `json:"chains"`
} }
var ( var (
@ -1390,7 +1384,7 @@ func (x *BearerToken_Body_APEOverride) StableSize() (size int) {
} }
size += proto.NestedStructureSize(1, x.Target) size += proto.NestedStructureSize(1, x.Target)
for i := range x.Chains { for i := range x.Chains {
size += proto.NestedStructureSize(2, x.Chains[i]) size += proto.NestedStructureSizeUnchecked(2, &x.Chains[i])
} }
return size return size
} }
@ -1412,9 +1406,7 @@ func (x *BearerToken_Body_APEOverride) EmitProtobuf(mm *easyproto.MessageMarshal
x.Target.EmitProtobuf(mm.AppendMessage(1)) x.Target.EmitProtobuf(mm.AppendMessage(1))
} }
for i := range x.Chains { for i := range x.Chains {
if x.Chains[i] != nil { x.Chains[i].EmitProtobuf(mm.AppendMessage(2))
x.Chains[i].EmitProtobuf(mm.AppendMessage(2))
}
} }
} }
@ -1441,8 +1433,8 @@ func (x *BearerToken_Body_APEOverride) UnmarshalProtobuf(src []byte) (err error)
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Chains") return fmt.Errorf("cannot unmarshal field %s", "Chains")
} }
x.Chains = append(x.Chains, new(grpc1.Chain)) x.Chains = append(x.Chains, grpc1.Chain{})
ff := x.Chains[len(x.Chains)-1] ff := &x.Chains[len(x.Chains)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1459,13 +1451,13 @@ func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget {
func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) { func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) {
x.Target = v x.Target = v
} }
func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { func (x *BearerToken_Body_APEOverride) GetChains() []grpc1.Chain {
if x != nil { if x != nil {
return x.Chains return x.Chains
} }
return nil return nil
} }
func (x *BearerToken_Body_APEOverride) SetChains(v []*grpc1.Chain) { func (x *BearerToken_Body_APEOverride) SetChains(v []grpc1.Chain) {
x.Chains = v x.Chains = v
} }
@ -1535,11 +1527,11 @@ func (x *BearerToken_Body_APEOverride) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "chains": case "chains":
{ {
var f *grpc1.Chain var f grpc1.Chain
var list []*grpc1.Chain var list []grpc1.Chain
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc1.Chain) f = grpc1.Chain{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -296,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
if respBody != nil { if respBody != nil {
respBodygrpc = new(apemanager.ListChainsResponse_Body) respBodygrpc = new(apemanager.ListChainsResponse_Body)
chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains())) chainsgrpc := make([]apeGRPC.Chain, 0, len(respBody.GetChains()))
for _, chain := range respBody.GetChains() { for _, chain := range respBody.GetChains() {
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain)) chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
} }
respBodygrpc.SetChains(chainsgrpc) respBodygrpc.SetChains(chainsgrpc)
@ -317,7 +317,7 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
for _, chaingrpc := range respBodygrpc.GetChains() { for _, chaingrpc := range respBodygrpc.GetChains() {
chain := new(ape.Chain) chain := new(ape.Chain)
if err := chain.FromGRPCMessage(chaingrpc); err != nil { if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
return err return err
} }
chains = append(chains, chain) chains = append(chains, chain)

View file

@ -1810,7 +1810,7 @@ func (x *ListChainsRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type ListChainsResponse_Body struct { type ListChainsResponse_Body struct {
Chains []*grpc.Chain `json:"chains"` Chains []grpc.Chain `json:"chains"`
} }
var ( var (
@ -1828,7 +1828,7 @@ func (x *ListChainsResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Chains { for i := range x.Chains {
size += proto.NestedStructureSize(1, x.Chains[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Chains[i])
} }
return size return size
} }
@ -1847,9 +1847,7 @@ func (x *ListChainsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.Chains { for i := range x.Chains {
if x.Chains[i] != nil { x.Chains[i].EmitProtobuf(mm.AppendMessage(1))
x.Chains[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
} }
@ -1867,8 +1865,8 @@ func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Chains") return fmt.Errorf("cannot unmarshal field %s", "Chains")
} }
x.Chains = append(x.Chains, new(grpc.Chain)) x.Chains = append(x.Chains, grpc.Chain{})
ff := x.Chains[len(x.Chains)-1] ff := &x.Chains[len(x.Chains)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1876,13 +1874,13 @@ func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *ListChainsResponse_Body) GetChains() []*grpc.Chain { func (x *ListChainsResponse_Body) GetChains() []grpc.Chain {
if x != nil { if x != nil {
return x.Chains return x.Chains
} }
return nil return nil
} }
func (x *ListChainsResponse_Body) SetChains(v []*grpc.Chain) { func (x *ListChainsResponse_Body) SetChains(v []grpc.Chain) {
x.Chains = v x.Chains = v
} }
@ -1940,11 +1938,11 @@ func (x *ListChainsResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "chains": case "chains":
{ {
var f *grpc.Chain var f grpc.Chain
var list []*grpc.Chain var list []grpc.Chain
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.Chain) f = grpc.Chain{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -39,28 +39,26 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func AttributesToGRPC(xs []Attribute) (res []*container.Container_Attribute) { func AttributesToGRPC(xs []Attribute) (res []container.Container_Attribute) {
if xs != nil { if xs != nil {
res = make([]*container.Container_Attribute, 0, len(xs)) res = make([]container.Container_Attribute, 0, len(xs))
for i := range xs { for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*container.Container_Attribute)) res = append(res, *xs[i].ToGRPCMessage().(*container.Container_Attribute))
} }
} }
return return
} }
func AttributesFromGRPC(xs []*container.Container_Attribute) (res []Attribute, err error) { func AttributesFromGRPC(xs []container.Container_Attribute) (res []Attribute, err error) {
if xs != nil { if xs != nil {
res = make([]Attribute, len(xs)) res = make([]Attribute, len(xs))
for i := range xs { for i := range xs {
if xs[i] != nil { err = res[i].FromGRPCMessage(&xs[i])
err = res[i].FromGRPCMessage(xs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }

View file

@ -2597,7 +2597,7 @@ func (x *ListRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type ListResponse_Body struct { type ListResponse_Body struct {
ContainerIds []*grpc.ContainerID `json:"containerIds"` ContainerIds []grpc.ContainerID `json:"containerIds"`
} }
var ( var (
@ -2615,7 +2615,7 @@ func (x *ListResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.ContainerIds { for i := range x.ContainerIds {
size += proto.NestedStructureSize(1, x.ContainerIds[i]) size += proto.NestedStructureSizeUnchecked(1, &x.ContainerIds[i])
} }
return size return size
} }
@ -2634,9 +2634,7 @@ func (x *ListResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.ContainerIds { for i := range x.ContainerIds {
if x.ContainerIds[i] != nil { x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1))
x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
} }
@ -2654,8 +2652,8 @@ func (x *ListResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "ContainerIds") return fmt.Errorf("cannot unmarshal field %s", "ContainerIds")
} }
x.ContainerIds = append(x.ContainerIds, new(grpc.ContainerID)) x.ContainerIds = append(x.ContainerIds, grpc.ContainerID{})
ff := x.ContainerIds[len(x.ContainerIds)-1] ff := &x.ContainerIds[len(x.ContainerIds)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -2663,13 +2661,13 @@ func (x *ListResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *ListResponse_Body) GetContainerIds() []*grpc.ContainerID { func (x *ListResponse_Body) GetContainerIds() []grpc.ContainerID {
if x != nil { if x != nil {
return x.ContainerIds return x.ContainerIds
} }
return nil return nil
} }
func (x *ListResponse_Body) SetContainerIds(v []*grpc.ContainerID) { func (x *ListResponse_Body) SetContainerIds(v []grpc.ContainerID) {
x.ContainerIds = v x.ContainerIds = v
} }
@ -2727,11 +2725,11 @@ func (x *ListResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "containerIds": case "containerIds":
{ {
var f *grpc.ContainerID var f grpc.ContainerID
var list []*grpc.ContainerID var list []grpc.ContainerID
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.ContainerID) f = grpc.ContainerID{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -180,7 +180,7 @@ type Container struct {
OwnerId *grpc.OwnerID `json:"ownerID"` OwnerId *grpc.OwnerID `json:"ownerID"`
Nonce []byte `json:"nonce"` Nonce []byte `json:"nonce"`
BasicAcl uint32 `json:"basicACL"` BasicAcl uint32 `json:"basicACL"`
Attributes []*Container_Attribute `json:"attributes"` Attributes []Container_Attribute `json:"attributes"`
PlacementPolicy *grpc1.PlacementPolicy `json:"placementPolicy"` PlacementPolicy *grpc1.PlacementPolicy `json:"placementPolicy"`
} }
@ -203,7 +203,7 @@ func (x *Container) StableSize() (size int) {
size += proto.BytesSize(3, x.Nonce) size += proto.BytesSize(3, x.Nonce)
size += proto.UInt32Size(4, x.BasicAcl) size += proto.UInt32Size(4, x.BasicAcl)
for i := range x.Attributes { for i := range x.Attributes {
size += proto.NestedStructureSize(5, x.Attributes[i]) size += proto.NestedStructureSizeUnchecked(5, &x.Attributes[i])
} }
size += proto.NestedStructureSize(6, x.PlacementPolicy) size += proto.NestedStructureSize(6, x.PlacementPolicy)
return size return size
@ -235,9 +235,7 @@ func (x *Container) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint32(4, x.BasicAcl) mm.AppendUint32(4, x.BasicAcl)
} }
for i := range x.Attributes { for i := range x.Attributes {
if x.Attributes[i] != nil { x.Attributes[i].EmitProtobuf(mm.AppendMessage(5))
x.Attributes[i].EmitProtobuf(mm.AppendMessage(5))
}
} }
if x.PlacementPolicy != nil { if x.PlacementPolicy != nil {
x.PlacementPolicy.EmitProtobuf(mm.AppendMessage(6)) x.PlacementPolicy.EmitProtobuf(mm.AppendMessage(6))
@ -288,8 +286,8 @@ func (x *Container) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Attributes") return fmt.Errorf("cannot unmarshal field %s", "Attributes")
} }
x.Attributes = append(x.Attributes, new(Container_Attribute)) x.Attributes = append(x.Attributes, Container_Attribute{})
ff := x.Attributes[len(x.Attributes)-1] ff := &x.Attributes[len(x.Attributes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -342,13 +340,13 @@ func (x *Container) GetBasicAcl() uint32 {
func (x *Container) SetBasicAcl(v uint32) { func (x *Container) SetBasicAcl(v uint32) {
x.BasicAcl = v x.BasicAcl = v
} }
func (x *Container) GetAttributes() []*Container_Attribute { func (x *Container) GetAttributes() []Container_Attribute {
if x != nil { if x != nil {
return x.Attributes return x.Attributes
} }
return nil return nil
} }
func (x *Container) SetAttributes(v []*Container_Attribute) { func (x *Container) SetAttributes(v []Container_Attribute) {
x.Attributes = v x.Attributes = v
} }
func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy {
@ -466,11 +464,11 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "attributes": case "attributes":
{ {
var f *Container_Attribute var f Container_Attribute
var list []*Container_Attribute var list []Container_Attribute
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Container_Attribute) f = Container_Attribute{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -15,7 +15,7 @@ import (
) )
type Lock struct { type Lock struct {
Members []*grpc.ObjectID `json:"members"` Members []grpc.ObjectID `json:"members"`
} }
var ( var (
@ -33,7 +33,7 @@ func (x *Lock) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Members { for i := range x.Members {
size += proto.NestedStructureSize(1, x.Members[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Members[i])
} }
return size return size
} }
@ -52,9 +52,7 @@ func (x *Lock) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.Members { for i := range x.Members {
if x.Members[i] != nil { x.Members[i].EmitProtobuf(mm.AppendMessage(1))
x.Members[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
} }
@ -72,8 +70,8 @@ func (x *Lock) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Members") return fmt.Errorf("cannot unmarshal field %s", "Members")
} }
x.Members = append(x.Members, new(grpc.ObjectID)) x.Members = append(x.Members, grpc.ObjectID{})
ff := x.Members[len(x.Members)-1] ff := &x.Members[len(x.Members)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -81,13 +79,13 @@ func (x *Lock) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *Lock) GetMembers() []*grpc.ObjectID { func (x *Lock) GetMembers() []grpc.ObjectID {
if x != nil { if x != nil {
return x.Members return x.Members
} }
return nil return nil
} }
func (x *Lock) SetMembers(v []*grpc.ObjectID) { func (x *Lock) SetMembers(v []grpc.ObjectID) {
x.Members = v x.Members = v
} }
@ -145,11 +143,11 @@ func (x *Lock) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "members": case "members":
{ {
var f *grpc.ObjectID var f grpc.ObjectID
var list []*grpc.ObjectID var list []grpc.ObjectID
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.ObjectID) f = grpc.ObjectID{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -45,28 +45,26 @@ func (f *Filter) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func FiltersToGRPC(fs []Filter) (res []*netmap.Filter) { func FiltersToGRPC(fs []Filter) (res []netmap.Filter) {
if fs != nil { if fs != nil {
res = make([]*netmap.Filter, 0, len(fs)) res = make([]netmap.Filter, 0, len(fs))
for i := range fs { for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter)) res = append(res, *fs[i].ToGRPCMessage().(*netmap.Filter))
} }
} }
return return
} }
func FiltersFromGRPC(fs []*netmap.Filter) (res []Filter, err error) { func FiltersFromGRPC(fs []netmap.Filter) (res []Filter, err error) {
if fs != nil { if fs != nil {
res = make([]Filter, len(fs)) res = make([]Filter, len(fs))
for i := range fs { for i := range fs {
if fs[i] != nil { err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -105,28 +103,26 @@ func (s *Selector) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func SelectorsToGRPC(ss []Selector) (res []*netmap.Selector) { func SelectorsToGRPC(ss []Selector) (res []netmap.Selector) {
if ss != nil { if ss != nil {
res = make([]*netmap.Selector, 0, len(ss)) res = make([]netmap.Selector, 0, len(ss))
for i := range ss { for i := range ss {
res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector)) res = append(res, *ss[i].ToGRPCMessage().(*netmap.Selector))
} }
} }
return return
} }
func SelectorsFromGRPC(ss []*netmap.Selector) (res []Selector, err error) { func SelectorsFromGRPC(ss []netmap.Selector) (res []Selector, err error) {
if ss != nil { if ss != nil {
res = make([]Selector, len(ss)) res = make([]Selector, len(ss))
for i := range ss { for i := range ss {
if ss[i] != nil { err = res[i].FromGRPCMessage(&ss[i])
err = res[i].FromGRPCMessage(ss[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -163,28 +159,26 @@ func (r *Replica) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func ReplicasToGRPC(rs []Replica) (res []*netmap.Replica) { func ReplicasToGRPC(rs []Replica) (res []netmap.Replica) {
if rs != nil { if rs != nil {
res = make([]*netmap.Replica, 0, len(rs)) res = make([]netmap.Replica, 0, len(rs))
for i := range rs { for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica)) res = append(res, *rs[i].ToGRPCMessage().(*netmap.Replica))
} }
} }
return return
} }
func ReplicasFromGRPC(rs []*netmap.Replica) (res []Replica, err error) { func ReplicasFromGRPC(rs []netmap.Replica) (res []Replica, err error) {
if rs != nil { if rs != nil {
res = make([]Replica, len(rs)) res = make([]Replica, len(rs))
for i := range rs { for i := range rs {
if rs[i] != nil { err = res[i].FromGRPCMessage(&rs[i])
err = res[i].FromGRPCMessage(rs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -289,28 +283,26 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func AttributesToGRPC(as []Attribute) (res []*netmap.NodeInfo_Attribute) { func AttributesToGRPC(as []Attribute) (res []netmap.NodeInfo_Attribute) {
if as != nil { if as != nil {
res = make([]*netmap.NodeInfo_Attribute, 0, len(as)) res = make([]netmap.NodeInfo_Attribute, 0, len(as))
for i := range as { for i := range as {
res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute)) res = append(res, *as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
} }
} }
return return
} }
func AttributesFromGRPC(as []*netmap.NodeInfo_Attribute) (res []Attribute, err error) { func AttributesFromGRPC(as []netmap.NodeInfo_Attribute) (res []Attribute, err error) {
if as != nil { if as != nil {
res = make([]Attribute, len(as)) res = make([]Attribute, len(as))
for i := range as { for i := range as {
if as[i] != nil { err = res[i].FromGRPCMessage(&as[i])
err = res[i].FromGRPCMessage(as[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -528,13 +520,13 @@ func (x *NetworkConfig) ToGRPCMessage() grpc.Message {
if x != nil { if x != nil {
m = new(netmap.NetworkConfig) m = new(netmap.NetworkConfig)
var ps []*netmap.NetworkConfig_Parameter var ps []netmap.NetworkConfig_Parameter
if ln := len(x.ps); ln > 0 { if ln := len(x.ps); ln > 0 {
ps = make([]*netmap.NetworkConfig_Parameter, 0, ln) ps = make([]netmap.NetworkConfig_Parameter, 0, ln)
for i := 0; i < ln; i++ { for i := 0; i < ln; i++ {
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter)) ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
} }
} }
@ -561,10 +553,8 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
ps = make([]NetworkParameter, ln) ps = make([]NetworkParameter, ln)
for i := 0; i < ln; i++ { for i := 0; i < ln; i++ {
if psV2[i] != nil { if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil {
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil { return err
return err
}
} }
} }
} }
@ -756,10 +746,10 @@ func (x *NetMap) ToGRPCMessage() grpc.Message {
m.SetEpoch(x.epoch) m.SetEpoch(x.epoch)
if x.nodes != nil { if x.nodes != nil {
nodes := make([]*netmap.NodeInfo, len(x.nodes)) nodes := make([]netmap.NodeInfo, len(x.nodes))
for i := range x.nodes { for i := range x.nodes {
nodes[i] = x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo) nodes[i] = *x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
} }
m.SetNodes(nodes) m.SetNodes(nodes)
@ -784,7 +774,7 @@ func (x *NetMap) FromGRPCMessage(m grpc.Message) error {
x.nodes = make([]NodeInfo, len(nodes)) x.nodes = make([]NodeInfo, len(nodes))
for i := range nodes { for i := range nodes {
err = x.nodes[i].FromGRPCMessage(nodes[i]) err = x.nodes[i].FromGRPCMessage(&nodes[i])
if err != nil { if err != nil {
return err return err
} }

View file

@ -113,7 +113,7 @@ type Filter struct {
Key string `json:"key"` Key string `json:"key"`
Op Operation `json:"op"` Op Operation `json:"op"`
Value string `json:"value"` Value string `json:"value"`
Filters []*Filter `json:"filters"` Filters []Filter `json:"filters"`
} }
var ( var (
@ -135,7 +135,7 @@ func (x *Filter) StableSize() (size int) {
size += proto.EnumSize(3, int32(x.Op)) size += proto.EnumSize(3, int32(x.Op))
size += proto.StringSize(4, x.Value) size += proto.StringSize(4, x.Value)
for i := range x.Filters { for i := range x.Filters {
size += proto.NestedStructureSize(5, x.Filters[i]) size += proto.NestedStructureSizeUnchecked(5, &x.Filters[i])
} }
return size return size
} }
@ -166,9 +166,7 @@ func (x *Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendString(4, x.Value) mm.AppendString(4, x.Value)
} }
for i := range x.Filters { for i := range x.Filters {
if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(5))
x.Filters[i].EmitProtobuf(mm.AppendMessage(5))
}
} }
} }
@ -210,8 +208,8 @@ func (x *Filter) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Filters") return fmt.Errorf("cannot unmarshal field %s", "Filters")
} }
x.Filters = append(x.Filters, new(Filter)) x.Filters = append(x.Filters, Filter{})
ff := x.Filters[len(x.Filters)-1] ff := &x.Filters[len(x.Filters)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -255,13 +253,13 @@ func (x *Filter) GetValue() string {
func (x *Filter) SetValue(v string) { func (x *Filter) SetValue(v string) {
x.Value = v x.Value = v
} }
func (x *Filter) GetFilters() []*Filter { func (x *Filter) GetFilters() []Filter {
if x != nil { if x != nil {
return x.Filters return x.Filters
} }
return nil return nil
} }
func (x *Filter) SetFilters(v []*Filter) { func (x *Filter) SetFilters(v []Filter) {
x.Filters = v x.Filters = v
} }
@ -379,11 +377,11 @@ func (x *Filter) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "filters": case "filters":
{ {
var f *Filter var f Filter
var list []*Filter var list []Filter
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Filter) f = Filter{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -892,11 +890,11 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type PlacementPolicy struct { type PlacementPolicy struct {
Replicas []*Replica `json:"replicas"` Replicas []Replica `json:"replicas"`
ContainerBackupFactor uint32 `json:"containerBackupFactor"` ContainerBackupFactor uint32 `json:"containerBackupFactor"`
Selectors []*Selector `json:"selectors"` Selectors []Selector `json:"selectors"`
Filters []*Filter `json:"filters"` Filters []Filter `json:"filters"`
Unique bool `json:"unique"` Unique bool `json:"unique"`
} }
var ( var (
@ -914,14 +912,14 @@ func (x *PlacementPolicy) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Replicas { for i := range x.Replicas {
size += proto.NestedStructureSize(1, x.Replicas[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Replicas[i])
} }
size += proto.UInt32Size(2, x.ContainerBackupFactor) size += proto.UInt32Size(2, x.ContainerBackupFactor)
for i := range x.Selectors { for i := range x.Selectors {
size += proto.NestedStructureSize(3, x.Selectors[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Selectors[i])
} }
for i := range x.Filters { for i := range x.Filters {
size += proto.NestedStructureSize(4, x.Filters[i]) size += proto.NestedStructureSizeUnchecked(4, &x.Filters[i])
} }
size += proto.BoolSize(5, x.Unique) size += proto.BoolSize(5, x.Unique)
return size return size
@ -941,22 +939,16 @@ func (x *PlacementPolicy) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.Replicas { for i := range x.Replicas {
if x.Replicas[i] != nil { x.Replicas[i].EmitProtobuf(mm.AppendMessage(1))
x.Replicas[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
if x.ContainerBackupFactor != 0 { if x.ContainerBackupFactor != 0 {
mm.AppendUint32(2, x.ContainerBackupFactor) mm.AppendUint32(2, x.ContainerBackupFactor)
} }
for i := range x.Selectors { for i := range x.Selectors {
if x.Selectors[i] != nil { x.Selectors[i].EmitProtobuf(mm.AppendMessage(3))
x.Selectors[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
for i := range x.Filters { for i := range x.Filters {
if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(4))
x.Filters[i].EmitProtobuf(mm.AppendMessage(4))
}
} }
if x.Unique { if x.Unique {
mm.AppendBool(5, x.Unique) mm.AppendBool(5, x.Unique)
@ -977,8 +969,8 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Replicas") return fmt.Errorf("cannot unmarshal field %s", "Replicas")
} }
x.Replicas = append(x.Replicas, new(Replica)) x.Replicas = append(x.Replicas, Replica{})
ff := x.Replicas[len(x.Replicas)-1] ff := &x.Replicas[len(x.Replicas)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -993,8 +985,8 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Selectors") return fmt.Errorf("cannot unmarshal field %s", "Selectors")
} }
x.Selectors = append(x.Selectors, new(Selector)) x.Selectors = append(x.Selectors, Selector{})
ff := x.Selectors[len(x.Selectors)-1] ff := &x.Selectors[len(x.Selectors)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1003,8 +995,8 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Filters") return fmt.Errorf("cannot unmarshal field %s", "Filters")
} }
x.Filters = append(x.Filters, new(Filter)) x.Filters = append(x.Filters, Filter{})
ff := x.Filters[len(x.Filters)-1] ff := &x.Filters[len(x.Filters)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1018,13 +1010,13 @@ func (x *PlacementPolicy) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *PlacementPolicy) GetReplicas() []*Replica { func (x *PlacementPolicy) GetReplicas() []Replica {
if x != nil { if x != nil {
return x.Replicas return x.Replicas
} }
return nil return nil
} }
func (x *PlacementPolicy) SetReplicas(v []*Replica) { func (x *PlacementPolicy) SetReplicas(v []Replica) {
x.Replicas = v x.Replicas = v
} }
func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { func (x *PlacementPolicy) GetContainerBackupFactor() uint32 {
@ -1036,22 +1028,22 @@ func (x *PlacementPolicy) GetContainerBackupFactor() uint32 {
func (x *PlacementPolicy) SetContainerBackupFactor(v uint32) { func (x *PlacementPolicy) SetContainerBackupFactor(v uint32) {
x.ContainerBackupFactor = v x.ContainerBackupFactor = v
} }
func (x *PlacementPolicy) GetSelectors() []*Selector { func (x *PlacementPolicy) GetSelectors() []Selector {
if x != nil { if x != nil {
return x.Selectors return x.Selectors
} }
return nil return nil
} }
func (x *PlacementPolicy) SetSelectors(v []*Selector) { func (x *PlacementPolicy) SetSelectors(v []Selector) {
x.Selectors = v x.Selectors = v
} }
func (x *PlacementPolicy) GetFilters() []*Filter { func (x *PlacementPolicy) GetFilters() []Filter {
if x != nil { if x != nil {
return x.Filters return x.Filters
} }
return nil return nil
} }
func (x *PlacementPolicy) SetFilters(v []*Filter) { func (x *PlacementPolicy) SetFilters(v []Filter) {
x.Filters = v x.Filters = v
} }
func (x *PlacementPolicy) GetUnique() bool { func (x *PlacementPolicy) GetUnique() bool {
@ -1152,11 +1144,11 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "replicas": case "replicas":
{ {
var f *Replica var f Replica
var list []*Replica var list []Replica
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Replica) f = Replica{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1172,11 +1164,11 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "selectors": case "selectors":
{ {
var f *Selector var f Selector
var list []*Selector var list []Selector
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Selector) f = Selector{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1186,11 +1178,11 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "filters": case "filters":
{ {
var f *Filter var f Filter
var list []*Filter var list []Filter
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Filter) f = Filter{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1457,10 +1449,10 @@ func (x *NodeInfo_Attribute) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type NodeInfo struct { type NodeInfo struct {
PublicKey []byte `json:"publicKey"` PublicKey []byte `json:"publicKey"`
Addresses []string `json:"addresses"` Addresses []string `json:"addresses"`
Attributes []*NodeInfo_Attribute `json:"attributes"` Attributes []NodeInfo_Attribute `json:"attributes"`
State NodeInfo_State `json:"state"` State NodeInfo_State `json:"state"`
} }
var ( var (
@ -1480,7 +1472,7 @@ func (x *NodeInfo) StableSize() (size int) {
size += proto.BytesSize(1, x.PublicKey) size += proto.BytesSize(1, x.PublicKey)
size += proto.RepeatedStringSize(2, x.Addresses) size += proto.RepeatedStringSize(2, x.Addresses)
for i := range x.Attributes { for i := range x.Attributes {
size += proto.NestedStructureSize(3, x.Attributes[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Attributes[i])
} }
size += proto.EnumSize(4, int32(x.State)) size += proto.EnumSize(4, int32(x.State))
return size return size
@ -1506,9 +1498,7 @@ func (x *NodeInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendString(2, x.Addresses[j]) mm.AppendString(2, x.Addresses[j])
} }
for i := range x.Attributes { for i := range x.Attributes {
if x.Attributes[i] != nil { x.Attributes[i].EmitProtobuf(mm.AppendMessage(3))
x.Attributes[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
if int32(x.State) != 0 { if int32(x.State) != 0 {
mm.AppendInt32(4, int32(x.State)) mm.AppendInt32(4, int32(x.State))
@ -1541,8 +1531,8 @@ func (x *NodeInfo) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Attributes") return fmt.Errorf("cannot unmarshal field %s", "Attributes")
} }
x.Attributes = append(x.Attributes, new(NodeInfo_Attribute)) x.Attributes = append(x.Attributes, NodeInfo_Attribute{})
ff := x.Attributes[len(x.Attributes)-1] ff := &x.Attributes[len(x.Attributes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1574,13 +1564,13 @@ func (x *NodeInfo) GetAddresses() []string {
func (x *NodeInfo) SetAddresses(v []string) { func (x *NodeInfo) SetAddresses(v []string) {
x.Addresses = v x.Addresses = v
} }
func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { func (x *NodeInfo) GetAttributes() []NodeInfo_Attribute {
if x != nil { if x != nil {
return x.Attributes return x.Attributes
} }
return nil return nil
} }
func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { func (x *NodeInfo) SetAttributes(v []NodeInfo_Attribute) {
x.Attributes = v x.Attributes = v
} }
func (x *NodeInfo) GetState() NodeInfo_State { func (x *NodeInfo) GetState() NodeInfo_State {
@ -1688,11 +1678,11 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "attributes": case "attributes":
{ {
var f *NodeInfo_Attribute var f NodeInfo_Attribute
var list []*NodeInfo_Attribute var list []NodeInfo_Attribute
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(NodeInfo_Attribute) f = NodeInfo_Attribute{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1732,8 +1722,8 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type Netmap struct { type Netmap struct {
Epoch uint64 `json:"epoch"` Epoch uint64 `json:"epoch"`
Nodes []*NodeInfo `json:"nodes"` Nodes []NodeInfo `json:"nodes"`
} }
var ( var (
@ -1752,7 +1742,7 @@ func (x *Netmap) StableSize() (size int) {
} }
size += proto.UInt64Size(1, x.Epoch) size += proto.UInt64Size(1, x.Epoch)
for i := range x.Nodes { for i := range x.Nodes {
size += proto.NestedStructureSize(2, x.Nodes[i]) size += proto.NestedStructureSizeUnchecked(2, &x.Nodes[i])
} }
return size return size
} }
@ -1774,9 +1764,7 @@ func (x *Netmap) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint64(1, x.Epoch) mm.AppendUint64(1, x.Epoch)
} }
for i := range x.Nodes { for i := range x.Nodes {
if x.Nodes[i] != nil { x.Nodes[i].EmitProtobuf(mm.AppendMessage(2))
x.Nodes[i].EmitProtobuf(mm.AppendMessage(2))
}
} }
} }
@ -1800,8 +1788,8 @@ func (x *Netmap) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Nodes") return fmt.Errorf("cannot unmarshal field %s", "Nodes")
} }
x.Nodes = append(x.Nodes, new(NodeInfo)) x.Nodes = append(x.Nodes, NodeInfo{})
ff := x.Nodes[len(x.Nodes)-1] ff := &x.Nodes[len(x.Nodes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1818,13 +1806,13 @@ func (x *Netmap) GetEpoch() uint64 {
func (x *Netmap) SetEpoch(v uint64) { func (x *Netmap) SetEpoch(v uint64) {
x.Epoch = v x.Epoch = v
} }
func (x *Netmap) GetNodes() []*NodeInfo { func (x *Netmap) GetNodes() []NodeInfo {
if x != nil { if x != nil {
return x.Nodes return x.Nodes
} }
return nil return nil
} }
func (x *Netmap) SetNodes(v []*NodeInfo) { func (x *Netmap) SetNodes(v []NodeInfo) {
x.Nodes = v x.Nodes = v
} }
@ -1893,11 +1881,11 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "nodes": case "nodes":
{ {
var f *NodeInfo var f NodeInfo
var list []*NodeInfo var list []NodeInfo
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(NodeInfo) f = NodeInfo{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -2075,7 +2063,7 @@ func (x *NetworkConfig_Parameter) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type NetworkConfig struct { type NetworkConfig struct {
Parameters []*NetworkConfig_Parameter `json:"parameters"` Parameters []NetworkConfig_Parameter `json:"parameters"`
} }
var ( var (
@ -2093,7 +2081,7 @@ func (x *NetworkConfig) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Parameters { for i := range x.Parameters {
size += proto.NestedStructureSize(1, x.Parameters[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Parameters[i])
} }
return size return size
} }
@ -2112,9 +2100,7 @@ func (x *NetworkConfig) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.Parameters { for i := range x.Parameters {
if x.Parameters[i] != nil { x.Parameters[i].EmitProtobuf(mm.AppendMessage(1))
x.Parameters[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
} }
@ -2132,8 +2118,8 @@ func (x *NetworkConfig) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Parameters") return fmt.Errorf("cannot unmarshal field %s", "Parameters")
} }
x.Parameters = append(x.Parameters, new(NetworkConfig_Parameter)) x.Parameters = append(x.Parameters, NetworkConfig_Parameter{})
ff := x.Parameters[len(x.Parameters)-1] ff := &x.Parameters[len(x.Parameters)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -2141,13 +2127,13 @@ func (x *NetworkConfig) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { func (x *NetworkConfig) GetParameters() []NetworkConfig_Parameter {
if x != nil { if x != nil {
return x.Parameters return x.Parameters
} }
return nil return nil
} }
func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { func (x *NetworkConfig) SetParameters(v []NetworkConfig_Parameter) {
x.Parameters = v x.Parameters = v
} }
@ -2205,11 +2191,11 @@ func (x *NetworkConfig) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "parameters": case "parameters":
{ {
var f *NetworkConfig_Parameter var f NetworkConfig_Parameter
var list []*NetworkConfig_Parameter var list []NetworkConfig_Parameter
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(NetworkConfig_Parameter) f = NetworkConfig_Parameter{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -142,28 +142,26 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func AttributesToGRPC(xs []Attribute) (res []*object.Header_Attribute) { func AttributesToGRPC(xs []Attribute) (res []object.Header_Attribute) {
if xs != nil { if xs != nil {
res = make([]*object.Header_Attribute, 0, len(xs)) res = make([]object.Header_Attribute, 0, len(xs))
for i := range xs { for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*object.Header_Attribute)) res = append(res, *xs[i].ToGRPCMessage().(*object.Header_Attribute))
} }
} }
return return
} }
func AttributesFromGRPC(xs []*object.Header_Attribute) (res []Attribute, err error) { func AttributesFromGRPC(xs []object.Header_Attribute) (res []Attribute, err error) {
if xs != nil { if xs != nil {
res = make([]Attribute, len(xs)) res = make([]Attribute, len(xs))
for i := range xs { for i := range xs {
if xs[i] != nil { err = res[i].FromGRPCMessage(&xs[i])
err = res[i].FromGRPCMessage(xs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -683,9 +681,9 @@ func (s *ECInfo) ToGRPCMessage() grpc.Message {
m = new(object.ECInfo) m = new(object.ECInfo)
if s.Chunks != nil { if s.Chunks != nil {
chunks := make([]*object.ECInfo_Chunk, len(s.Chunks)) chunks := make([]object.ECInfo_Chunk, len(s.Chunks))
for i := range chunks { for i := range chunks {
chunks[i] = s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk) chunks[i] = *s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
} }
m.Chunks = chunks m.Chunks = chunks
} }
@ -706,7 +704,7 @@ func (s *ECInfo) FromGRPCMessage(m grpc.Message) error {
} else { } else {
s.Chunks = make([]ECChunk, len(chunks)) s.Chunks = make([]ECChunk, len(chunks))
for i := range chunks { for i := range chunks {
if err := s.Chunks[i].FromGRPCMessage(chunks[i]); err != nil { if err := s.Chunks[i].FromGRPCMessage(&chunks[i]); err != nil {
return err return err
} }
} }
@ -1626,28 +1624,26 @@ func (f *SearchFilter) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func SearchFiltersToGRPC(fs []SearchFilter) (res []*object.SearchRequest_Body_Filter) { func SearchFiltersToGRPC(fs []SearchFilter) (res []object.SearchRequest_Body_Filter) {
if fs != nil { if fs != nil {
res = make([]*object.SearchRequest_Body_Filter, 0, len(fs)) res = make([]object.SearchRequest_Body_Filter, 0, len(fs))
for i := range fs { for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter)) res = append(res, *fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
} }
} }
return return
} }
func SearchFiltersFromGRPC(fs []*object.SearchRequest_Body_Filter) (res []SearchFilter, err error) { func SearchFiltersFromGRPC(fs []object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
if fs != nil { if fs != nil {
res = make([]SearchFilter, len(fs)) res = make([]SearchFilter, len(fs))
for i := range fs { for i := range fs {
if fs[i] != nil { err = res[i].FromGRPCMessage(&fs[i])
err = res[i].FromGRPCMessage(fs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -1827,28 +1823,26 @@ func (r *Range) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func RangesToGRPC(rs []Range) (res []*object.Range) { func RangesToGRPC(rs []Range) (res []object.Range) {
if rs != nil { if rs != nil {
res = make([]*object.Range, 0, len(rs)) res = make([]object.Range, 0, len(rs))
for i := range rs { for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*object.Range)) res = append(res, *rs[i].ToGRPCMessage().(*object.Range))
} }
} }
return return
} }
func RangesFromGRPC(rs []*object.Range) (res []Range, err error) { func RangesFromGRPC(rs []object.Range) (res []Range, err error) {
if rs != nil { if rs != nil {
res = make([]Range, len(rs)) res = make([]Range, len(rs))
for i := range rs { for i := range rs {
if rs[i] != nil { err = res[i].FromGRPCMessage(&rs[i])
err = res[i].FromGRPCMessage(rs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }

View file

@ -4201,9 +4201,9 @@ func (x *SearchRequest_Body_Filter) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type SearchRequest_Body struct { type SearchRequest_Body struct {
ContainerId *grpc.ContainerID `json:"containerId"` ContainerId *grpc.ContainerID `json:"containerId"`
Version uint32 `json:"version"` Version uint32 `json:"version"`
Filters []*SearchRequest_Body_Filter `json:"filters"` Filters []SearchRequest_Body_Filter `json:"filters"`
} }
var ( var (
@ -4223,7 +4223,7 @@ func (x *SearchRequest_Body) StableSize() (size int) {
size += proto.NestedStructureSize(1, x.ContainerId) size += proto.NestedStructureSize(1, x.ContainerId)
size += proto.UInt32Size(2, x.Version) size += proto.UInt32Size(2, x.Version)
for i := range x.Filters { for i := range x.Filters {
size += proto.NestedStructureSize(3, x.Filters[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Filters[i])
} }
return size return size
} }
@ -4248,9 +4248,7 @@ func (x *SearchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint32(2, x.Version) mm.AppendUint32(2, x.Version)
} }
for i := range x.Filters { for i := range x.Filters {
if x.Filters[i] != nil { x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
} }
@ -4283,8 +4281,8 @@ func (x *SearchRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Filters") return fmt.Errorf("cannot unmarshal field %s", "Filters")
} }
x.Filters = append(x.Filters, new(SearchRequest_Body_Filter)) x.Filters = append(x.Filters, SearchRequest_Body_Filter{})
ff := x.Filters[len(x.Filters)-1] ff := &x.Filters[len(x.Filters)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -4310,13 +4308,13 @@ func (x *SearchRequest_Body) GetVersion() uint32 {
func (x *SearchRequest_Body) SetVersion(v uint32) { func (x *SearchRequest_Body) SetVersion(v uint32) {
x.Version = v x.Version = v
} }
func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { func (x *SearchRequest_Body) GetFilters() []SearchRequest_Body_Filter {
if x != nil { if x != nil {
return x.Filters return x.Filters
} }
return nil return nil
} }
func (x *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { func (x *SearchRequest_Body) SetFilters(v []SearchRequest_Body_Filter) {
x.Filters = v x.Filters = v
} }
@ -4397,11 +4395,11 @@ func (x *SearchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "filters": case "filters":
{ {
var f *SearchRequest_Body_Filter var f SearchRequest_Body_Filter
var list []*SearchRequest_Body_Filter var list []SearchRequest_Body_Filter
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(SearchRequest_Body_Filter) f = SearchRequest_Body_Filter{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -4640,7 +4638,7 @@ func (x *SearchRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type SearchResponse_Body struct { type SearchResponse_Body struct {
IdList []*grpc.ObjectID `json:"idList"` IdList []grpc.ObjectID `json:"idList"`
} }
var ( var (
@ -4658,7 +4656,7 @@ func (x *SearchResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.IdList { for i := range x.IdList {
size += proto.NestedStructureSize(1, x.IdList[i]) size += proto.NestedStructureSizeUnchecked(1, &x.IdList[i])
} }
return size return size
} }
@ -4677,9 +4675,7 @@ func (x *SearchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.IdList { for i := range x.IdList {
if x.IdList[i] != nil { x.IdList[i].EmitProtobuf(mm.AppendMessage(1))
x.IdList[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
} }
@ -4697,8 +4693,8 @@ func (x *SearchResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "IdList") return fmt.Errorf("cannot unmarshal field %s", "IdList")
} }
x.IdList = append(x.IdList, new(grpc.ObjectID)) x.IdList = append(x.IdList, grpc.ObjectID{})
ff := x.IdList[len(x.IdList)-1] ff := &x.IdList[len(x.IdList)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -4706,13 +4702,13 @@ func (x *SearchResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *SearchResponse_Body) GetIdList() []*grpc.ObjectID { func (x *SearchResponse_Body) GetIdList() []grpc.ObjectID {
if x != nil { if x != nil {
return x.IdList return x.IdList
} }
return nil return nil
} }
func (x *SearchResponse_Body) SetIdList(v []*grpc.ObjectID) { func (x *SearchResponse_Body) SetIdList(v []grpc.ObjectID) {
x.IdList = v x.IdList = v
} }
@ -4770,11 +4766,11 @@ func (x *SearchResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "idList": case "idList":
{ {
var f *grpc.ObjectID var f grpc.ObjectID
var list []*grpc.ObjectID var list []grpc.ObjectID
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.ObjectID) f = grpc.ObjectID{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -6077,7 +6073,7 @@ func (x *GetRangeResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
type GetRangeHashRequest_Body struct { type GetRangeHashRequest_Body struct {
Address *grpc.Address `json:"address"` Address *grpc.Address `json:"address"`
Ranges []*Range `json:"ranges"` Ranges []Range `json:"ranges"`
Salt []byte `json:"salt"` Salt []byte `json:"salt"`
Type grpc.ChecksumType `json:"type"` Type grpc.ChecksumType `json:"type"`
} }
@ -6098,7 +6094,7 @@ func (x *GetRangeHashRequest_Body) StableSize() (size int) {
} }
size += proto.NestedStructureSize(1, x.Address) size += proto.NestedStructureSize(1, x.Address)
for i := range x.Ranges { for i := range x.Ranges {
size += proto.NestedStructureSize(2, x.Ranges[i]) size += proto.NestedStructureSizeUnchecked(2, &x.Ranges[i])
} }
size += proto.BytesSize(3, x.Salt) size += proto.BytesSize(3, x.Salt)
size += proto.EnumSize(4, int32(x.Type)) size += proto.EnumSize(4, int32(x.Type))
@ -6122,9 +6118,7 @@ func (x *GetRangeHashRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler)
x.Address.EmitProtobuf(mm.AppendMessage(1)) x.Address.EmitProtobuf(mm.AppendMessage(1))
} }
for i := range x.Ranges { for i := range x.Ranges {
if x.Ranges[i] != nil { x.Ranges[i].EmitProtobuf(mm.AppendMessage(2))
x.Ranges[i].EmitProtobuf(mm.AppendMessage(2))
}
} }
if len(x.Salt) != 0 { if len(x.Salt) != 0 {
mm.AppendBytes(3, x.Salt) mm.AppendBytes(3, x.Salt)
@ -6157,8 +6151,8 @@ func (x *GetRangeHashRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Ranges") return fmt.Errorf("cannot unmarshal field %s", "Ranges")
} }
x.Ranges = append(x.Ranges, new(Range)) x.Ranges = append(x.Ranges, Range{})
ff := x.Ranges[len(x.Ranges)-1] ff := &x.Ranges[len(x.Ranges)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -6187,13 +6181,13 @@ func (x *GetRangeHashRequest_Body) GetAddress() *grpc.Address {
func (x *GetRangeHashRequest_Body) SetAddress(v *grpc.Address) { func (x *GetRangeHashRequest_Body) SetAddress(v *grpc.Address) {
x.Address = v x.Address = v
} }
func (x *GetRangeHashRequest_Body) GetRanges() []*Range { func (x *GetRangeHashRequest_Body) GetRanges() []Range {
if x != nil { if x != nil {
return x.Ranges return x.Ranges
} }
return nil return nil
} }
func (x *GetRangeHashRequest_Body) SetRanges(v []*Range) { func (x *GetRangeHashRequest_Body) SetRanges(v []Range) {
x.Ranges = v x.Ranges = v
} }
func (x *GetRangeHashRequest_Body) GetSalt() []byte { func (x *GetRangeHashRequest_Body) GetSalt() []byte {
@ -6291,11 +6285,11 @@ func (x *GetRangeHashRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "ranges": case "ranges":
{ {
var f *Range var f Range
var list []*Range var list []Range
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Range) f = Range{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -7855,7 +7849,7 @@ func (x *PatchRequest_Body_Patch) UnmarshalEasyJSON(in *jlexer.Lexer) {
type PatchRequest_Body struct { type PatchRequest_Body struct {
Address *grpc.Address `json:"address"` Address *grpc.Address `json:"address"`
NewAttributes []*Header_Attribute `json:"newAttributes"` NewAttributes []Header_Attribute `json:"newAttributes"`
ReplaceAttributes bool `json:"replaceAttributes"` ReplaceAttributes bool `json:"replaceAttributes"`
Patch *PatchRequest_Body_Patch `json:"patch"` Patch *PatchRequest_Body_Patch `json:"patch"`
} }
@ -7876,7 +7870,7 @@ func (x *PatchRequest_Body) StableSize() (size int) {
} }
size += proto.NestedStructureSize(1, x.Address) size += proto.NestedStructureSize(1, x.Address)
for i := range x.NewAttributes { for i := range x.NewAttributes {
size += proto.NestedStructureSize(2, x.NewAttributes[i]) size += proto.NestedStructureSizeUnchecked(2, &x.NewAttributes[i])
} }
size += proto.BoolSize(3, x.ReplaceAttributes) size += proto.BoolSize(3, x.ReplaceAttributes)
size += proto.NestedStructureSize(4, x.Patch) size += proto.NestedStructureSize(4, x.Patch)
@ -7900,9 +7894,7 @@ func (x *PatchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
x.Address.EmitProtobuf(mm.AppendMessage(1)) x.Address.EmitProtobuf(mm.AppendMessage(1))
} }
for i := range x.NewAttributes { for i := range x.NewAttributes {
if x.NewAttributes[i] != nil { x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2))
x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2))
}
} }
if x.ReplaceAttributes { if x.ReplaceAttributes {
mm.AppendBool(3, x.ReplaceAttributes) mm.AppendBool(3, x.ReplaceAttributes)
@ -7935,8 +7927,8 @@ func (x *PatchRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "NewAttributes") return fmt.Errorf("cannot unmarshal field %s", "NewAttributes")
} }
x.NewAttributes = append(x.NewAttributes, new(Header_Attribute)) x.NewAttributes = append(x.NewAttributes, Header_Attribute{})
ff := x.NewAttributes[len(x.NewAttributes)-1] ff := &x.NewAttributes[len(x.NewAttributes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -7968,13 +7960,13 @@ func (x *PatchRequest_Body) GetAddress() *grpc.Address {
func (x *PatchRequest_Body) SetAddress(v *grpc.Address) { func (x *PatchRequest_Body) SetAddress(v *grpc.Address) {
x.Address = v x.Address = v
} }
func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { func (x *PatchRequest_Body) GetNewAttributes() []Header_Attribute {
if x != nil { if x != nil {
return x.NewAttributes return x.NewAttributes
} }
return nil return nil
} }
func (x *PatchRequest_Body) SetNewAttributes(v []*Header_Attribute) { func (x *PatchRequest_Body) SetNewAttributes(v []Header_Attribute) {
x.NewAttributes = v x.NewAttributes = v
} }
func (x *PatchRequest_Body) GetReplaceAttributes() bool { func (x *PatchRequest_Body) GetReplaceAttributes() bool {
@ -8072,11 +8064,11 @@ func (x *PatchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "newAttributes": case "newAttributes":
{ {
var f *Header_Attribute var f Header_Attribute
var list []*Header_Attribute var list []Header_Attribute
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Header_Attribute) f = Header_Attribute{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -600,12 +600,12 @@ func (x *Header_Attribute) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type Header_Split struct { type Header_Split struct {
Parent *grpc.ObjectID `json:"parent"` Parent *grpc.ObjectID `json:"parent"`
Previous *grpc.ObjectID `json:"previous"` Previous *grpc.ObjectID `json:"previous"`
ParentSignature *grpc.Signature `json:"parentSignature"` ParentSignature *grpc.Signature `json:"parentSignature"`
ParentHeader *Header `json:"parentHeader"` ParentHeader *Header `json:"parentHeader"`
Children []*grpc.ObjectID `json:"children"` Children []grpc.ObjectID `json:"children"`
SplitId []byte `json:"splitID"` SplitId []byte `json:"splitID"`
} }
var ( var (
@ -627,7 +627,7 @@ func (x *Header_Split) StableSize() (size int) {
size += proto.NestedStructureSize(3, x.ParentSignature) size += proto.NestedStructureSize(3, x.ParentSignature)
size += proto.NestedStructureSize(4, x.ParentHeader) size += proto.NestedStructureSize(4, x.ParentHeader)
for i := range x.Children { for i := range x.Children {
size += proto.NestedStructureSize(5, x.Children[i]) size += proto.NestedStructureSizeUnchecked(5, &x.Children[i])
} }
size += proto.BytesSize(6, x.SplitId) size += proto.BytesSize(6, x.SplitId)
return size return size
@ -659,9 +659,7 @@ func (x *Header_Split) EmitProtobuf(mm *easyproto.MessageMarshaler) {
x.ParentHeader.EmitProtobuf(mm.AppendMessage(4)) x.ParentHeader.EmitProtobuf(mm.AppendMessage(4))
} }
for i := range x.Children { for i := range x.Children {
if x.Children[i] != nil { x.Children[i].EmitProtobuf(mm.AppendMessage(5))
x.Children[i].EmitProtobuf(mm.AppendMessage(5))
}
} }
if len(x.SplitId) != 0 { if len(x.SplitId) != 0 {
mm.AppendBytes(6, x.SplitId) mm.AppendBytes(6, x.SplitId)
@ -718,8 +716,8 @@ func (x *Header_Split) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Children") return fmt.Errorf("cannot unmarshal field %s", "Children")
} }
x.Children = append(x.Children, new(grpc.ObjectID)) x.Children = append(x.Children, grpc.ObjectID{})
ff := x.Children[len(x.Children)-1] ff := &x.Children[len(x.Children)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -769,13 +767,13 @@ func (x *Header_Split) GetParentHeader() *Header {
func (x *Header_Split) SetParentHeader(v *Header) { func (x *Header_Split) SetParentHeader(v *Header) {
x.ParentHeader = v x.ParentHeader = v
} }
func (x *Header_Split) GetChildren() []*grpc.ObjectID { func (x *Header_Split) GetChildren() []grpc.ObjectID {
if x != nil { if x != nil {
return x.Children return x.Children
} }
return nil return nil
} }
func (x *Header_Split) SetChildren(v []*grpc.ObjectID) { func (x *Header_Split) SetChildren(v []grpc.ObjectID) {
x.Children = v x.Children = v
} }
func (x *Header_Split) GetSplitId() []byte { func (x *Header_Split) GetSplitId() []byte {
@ -895,11 +893,11 @@ func (x *Header_Split) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "children": case "children":
{ {
var f *grpc.ObjectID var f grpc.ObjectID
var list []*grpc.ObjectID var list []grpc.ObjectID
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.ObjectID) f = grpc.ObjectID{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -923,14 +921,14 @@ func (x *Header_Split) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type Header_EC struct { type Header_EC struct {
Parent *grpc.ObjectID `json:"parent"` Parent *grpc.ObjectID `json:"parent"`
Index uint32 `json:"index"` Index uint32 `json:"index"`
Total uint32 `json:"total"` Total uint32 `json:"total"`
HeaderLength uint32 `json:"headerLength"` HeaderLength uint32 `json:"headerLength"`
Header []byte `json:"header"` Header []byte `json:"header"`
ParentSplitId []byte `json:"parentSplitID"` ParentSplitId []byte `json:"parentSplitID"`
ParentSplitParentId *grpc.ObjectID `json:"parentSplitParentID"` ParentSplitParentId *grpc.ObjectID `json:"parentSplitParentID"`
ParentAttributes []*Header_Attribute `json:"parentAttributes"` ParentAttributes []Header_Attribute `json:"parentAttributes"`
} }
var ( var (
@ -955,7 +953,7 @@ func (x *Header_EC) StableSize() (size int) {
size += proto.BytesSize(6, x.ParentSplitId) size += proto.BytesSize(6, x.ParentSplitId)
size += proto.NestedStructureSize(7, x.ParentSplitParentId) size += proto.NestedStructureSize(7, x.ParentSplitParentId)
for i := range x.ParentAttributes { for i := range x.ParentAttributes {
size += proto.NestedStructureSize(8, x.ParentAttributes[i]) size += proto.NestedStructureSizeUnchecked(8, &x.ParentAttributes[i])
} }
return size return size
} }
@ -995,9 +993,7 @@ func (x *Header_EC) EmitProtobuf(mm *easyproto.MessageMarshaler) {
x.ParentSplitParentId.EmitProtobuf(mm.AppendMessage(7)) x.ParentSplitParentId.EmitProtobuf(mm.AppendMessage(7))
} }
for i := range x.ParentAttributes { for i := range x.ParentAttributes {
if x.ParentAttributes[i] != nil { x.ParentAttributes[i].EmitProtobuf(mm.AppendMessage(8))
x.ParentAttributes[i].EmitProtobuf(mm.AppendMessage(8))
}
} }
} }
@ -1063,8 +1059,8 @@ func (x *Header_EC) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "ParentAttributes") return fmt.Errorf("cannot unmarshal field %s", "ParentAttributes")
} }
x.ParentAttributes = append(x.ParentAttributes, new(Header_Attribute)) x.ParentAttributes = append(x.ParentAttributes, Header_Attribute{})
ff := x.ParentAttributes[len(x.ParentAttributes)-1] ff := &x.ParentAttributes[len(x.ParentAttributes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1135,13 +1131,13 @@ func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID {
func (x *Header_EC) SetParentSplitParentId(v *grpc.ObjectID) { func (x *Header_EC) SetParentSplitParentId(v *grpc.ObjectID) {
x.ParentSplitParentId = v x.ParentSplitParentId = v
} }
func (x *Header_EC) GetParentAttributes() []*Header_Attribute { func (x *Header_EC) GetParentAttributes() []Header_Attribute {
if x != nil { if x != nil {
return x.ParentAttributes return x.ParentAttributes
} }
return nil return nil
} }
func (x *Header_EC) SetParentAttributes(v []*Header_Attribute) { func (x *Header_EC) SetParentAttributes(v []Header_Attribute) {
x.ParentAttributes = v x.ParentAttributes = v
} }
@ -1278,11 +1274,11 @@ func (x *Header_EC) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "parentAttributes": case "parentAttributes":
{ {
var f *Header_Attribute var f Header_Attribute
var list []*Header_Attribute var list []Header_Attribute
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Header_Attribute) f = Header_Attribute{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1309,7 +1305,7 @@ type Header struct {
ObjectType ObjectType `json:"objectType"` ObjectType ObjectType `json:"objectType"`
HomomorphicHash *grpc.Checksum `json:"homomorphicHash"` HomomorphicHash *grpc.Checksum `json:"homomorphicHash"`
SessionToken *grpc1.SessionToken `json:"sessionToken"` SessionToken *grpc1.SessionToken `json:"sessionToken"`
Attributes []*Header_Attribute `json:"attributes"` Attributes []Header_Attribute `json:"attributes"`
Split *Header_Split `json:"split"` Split *Header_Split `json:"split"`
Ec *Header_EC `json:"ec"` Ec *Header_EC `json:"ec"`
} }
@ -1338,7 +1334,7 @@ func (x *Header) StableSize() (size int) {
size += proto.NestedStructureSize(8, x.HomomorphicHash) size += proto.NestedStructureSize(8, x.HomomorphicHash)
size += proto.NestedStructureSize(9, x.SessionToken) size += proto.NestedStructureSize(9, x.SessionToken)
for i := range x.Attributes { for i := range x.Attributes {
size += proto.NestedStructureSize(10, x.Attributes[i]) size += proto.NestedStructureSizeUnchecked(10, &x.Attributes[i])
} }
size += proto.NestedStructureSize(11, x.Split) size += proto.NestedStructureSize(11, x.Split)
size += proto.NestedStructureSize(12, x.Ec) size += proto.NestedStructureSize(12, x.Ec)
@ -1386,9 +1382,7 @@ func (x *Header) EmitProtobuf(mm *easyproto.MessageMarshaler) {
x.SessionToken.EmitProtobuf(mm.AppendMessage(9)) x.SessionToken.EmitProtobuf(mm.AppendMessage(9))
} }
for i := range x.Attributes { for i := range x.Attributes {
if x.Attributes[i] != nil { x.Attributes[i].EmitProtobuf(mm.AppendMessage(10))
x.Attributes[i].EmitProtobuf(mm.AppendMessage(10))
}
} }
if x.Split != nil { if x.Split != nil {
x.Split.EmitProtobuf(mm.AppendMessage(11)) x.Split.EmitProtobuf(mm.AppendMessage(11))
@ -1484,8 +1478,8 @@ func (x *Header) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Attributes") return fmt.Errorf("cannot unmarshal field %s", "Attributes")
} }
x.Attributes = append(x.Attributes, new(Header_Attribute)) x.Attributes = append(x.Attributes, Header_Attribute{})
ff := x.Attributes[len(x.Attributes)-1] ff := &x.Attributes[len(x.Attributes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1592,13 +1586,13 @@ func (x *Header) GetSessionToken() *grpc1.SessionToken {
func (x *Header) SetSessionToken(v *grpc1.SessionToken) { func (x *Header) SetSessionToken(v *grpc1.SessionToken) {
x.SessionToken = v x.SessionToken = v
} }
func (x *Header) GetAttributes() []*Header_Attribute { func (x *Header) GetAttributes() []Header_Attribute {
if x != nil { if x != nil {
return x.Attributes return x.Attributes
} }
return nil return nil
} }
func (x *Header) SetAttributes(v []*Header_Attribute) { func (x *Header) SetAttributes(v []Header_Attribute) {
x.Attributes = v x.Attributes = v
} }
func (x *Header) GetSplit() *Header_Split { func (x *Header) GetSplit() *Header_Split {
@ -1805,11 +1799,11 @@ func (x *Header) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "attributes": case "attributes":
{ {
var f *Header_Attribute var f Header_Attribute
var list []*Header_Attribute var list []Header_Attribute
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Header_Attribute) f = Header_Attribute{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -2469,7 +2463,7 @@ func (x *ECInfo_Chunk) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type ECInfo struct { type ECInfo struct {
Chunks []*ECInfo_Chunk `json:"chunks"` Chunks []ECInfo_Chunk `json:"chunks"`
} }
var ( var (
@ -2487,7 +2481,7 @@ func (x *ECInfo) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Chunks { for i := range x.Chunks {
size += proto.NestedStructureSize(1, x.Chunks[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Chunks[i])
} }
return size return size
} }
@ -2506,9 +2500,7 @@ func (x *ECInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.Chunks { for i := range x.Chunks {
if x.Chunks[i] != nil { x.Chunks[i].EmitProtobuf(mm.AppendMessage(1))
x.Chunks[i].EmitProtobuf(mm.AppendMessage(1))
}
} }
} }
@ -2526,8 +2518,8 @@ func (x *ECInfo) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Chunks") return fmt.Errorf("cannot unmarshal field %s", "Chunks")
} }
x.Chunks = append(x.Chunks, new(ECInfo_Chunk)) x.Chunks = append(x.Chunks, ECInfo_Chunk{})
ff := x.Chunks[len(x.Chunks)-1] ff := &x.Chunks[len(x.Chunks)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -2535,13 +2527,13 @@ func (x *ECInfo) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *ECInfo) GetChunks() []*ECInfo_Chunk { func (x *ECInfo) GetChunks() []ECInfo_Chunk {
if x != nil { if x != nil {
return x.Chunks return x.Chunks
} }
return nil return nil
} }
func (x *ECInfo) SetChunks(v []*ECInfo_Chunk) { func (x *ECInfo) SetChunks(v []ECInfo_Chunk) {
x.Chunks = v x.Chunks = v
} }
@ -2599,11 +2591,11 @@ func (x *ECInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "chunks": case "chunks":
{ {
var f *ECInfo_Chunk var f ECInfo_Chunk
var list []*ECInfo_Chunk var list []ECInfo_Chunk
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(ECInfo_Chunk) f = ECInfo_Chunk{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -89,13 +89,13 @@ func (x *Lock) ToGRPCMessage() grpc.Message {
if x != nil { if x != nil {
m = new(lock.Lock) m = new(lock.Lock)
var members []*refsGRPC.ObjectID var members []refsGRPC.ObjectID
if x.members != nil { if x.members != nil {
members = make([]*refsGRPC.ObjectID, len(x.members)) members = make([]refsGRPC.ObjectID, len(x.members))
for i := range x.members { for i := range x.members {
members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID) members[i] = *x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
} }
} }
@ -119,7 +119,7 @@ func (x *Lock) FromGRPCMessage(m grpc.Message) error {
var err error var err error
for i := range x.members { for i := range x.members {
err = x.members[i].FromGRPCMessage(members[i]) err = x.members[i].FromGRPCMessage(&members[i])
if err != nil { if err != nil {
return err return err
} }

View file

@ -52,28 +52,26 @@ func (c *ContainerID) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []*refs.ContainerID) { func ContainerIDsToGRPCMessage(ids []ContainerID) (res []refs.ContainerID) {
if ids != nil { if ids != nil {
res = make([]*refs.ContainerID, 0, len(ids)) res = make([]refs.ContainerID, 0, len(ids))
for i := range ids { for i := range ids {
res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID)) res = append(res, *ids[i].ToGRPCMessage().(*refs.ContainerID))
} }
} }
return return
} }
func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []ContainerID, err error) { func ContainerIDsFromGRPCMessage(idsV2 []refs.ContainerID) (res []ContainerID, err error) {
if idsV2 != nil { if idsV2 != nil {
res = make([]ContainerID, len(idsV2)) res = make([]ContainerID, len(idsV2))
for i := range idsV2 { for i := range idsV2 {
if idsV2[i] != nil { err = res[i].FromGRPCMessage(&idsV2[i])
err = res[i].FromGRPCMessage(idsV2[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }
@ -104,28 +102,26 @@ func (o *ObjectID) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []*refs.ObjectID) { func ObjectIDListToGRPCMessage(ids []ObjectID) (res []refs.ObjectID) {
if ids != nil { if ids != nil {
res = make([]*refs.ObjectID, 0, len(ids)) res = make([]refs.ObjectID, 0, len(ids))
for i := range ids { for i := range ids {
res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID)) res = append(res, *ids[i].ToGRPCMessage().(*refs.ObjectID))
} }
} }
return return
} }
func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []ObjectID, err error) { func ObjectIDListFromGRPCMessage(idsV2 []refs.ObjectID) (res []ObjectID, err error) {
if idsV2 != nil { if idsV2 != nil {
res = make([]ObjectID, len(idsV2)) res = make([]ObjectID, len(idsV2))
for i := range idsV2 { for i := range idsV2 {
if idsV2[i] != nil { err = res[i].FromGRPCMessage(&idsV2[i])
err = res[i].FromGRPCMessage(idsV2[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }

View file

@ -207,28 +207,26 @@ func (x *XHeader) FromGRPCMessage(m grpc.Message) error {
return nil return nil
} }
func XHeadersToGRPC(xs []XHeader) (res []*session.XHeader) { func XHeadersToGRPC(xs []XHeader) (res []session.XHeader) {
if xs != nil { if xs != nil {
res = make([]*session.XHeader, 0, len(xs)) res = make([]session.XHeader, 0, len(xs))
for i := range xs { for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*session.XHeader)) res = append(res, *xs[i].ToGRPCMessage().(*session.XHeader))
} }
} }
return return
} }
func XHeadersFromGRPC(xs []*session.XHeader) (res []XHeader, err error) { func XHeadersFromGRPC(xs []session.XHeader) (res []XHeader, err error) {
if xs != nil { if xs != nil {
res = make([]XHeader, len(xs)) res = make([]XHeader, len(xs))
for i := range xs { for i := range xs {
if xs[i] != nil { err = res[i].FromGRPCMessage(&xs[i])
err = res[i].FromGRPCMessage(xs[i]) if err != nil {
if err != nil { return
return
}
} }
} }
} }

View file

@ -72,7 +72,7 @@ func (x *ObjectSessionContext_Verb) FromString(s string) bool {
type ObjectSessionContext_Target struct { type ObjectSessionContext_Target struct {
Container *grpc.ContainerID `json:"container"` Container *grpc.ContainerID `json:"container"`
Objects []*grpc.ObjectID `json:"objects"` Objects []grpc.ObjectID `json:"objects"`
} }
var ( var (
@ -91,7 +91,7 @@ func (x *ObjectSessionContext_Target) StableSize() (size int) {
} }
size += proto.NestedStructureSize(1, x.Container) size += proto.NestedStructureSize(1, x.Container)
for i := range x.Objects { for i := range x.Objects {
size += proto.NestedStructureSize(2, x.Objects[i]) size += proto.NestedStructureSizeUnchecked(2, &x.Objects[i])
} }
return size return size
} }
@ -113,9 +113,7 @@ func (x *ObjectSessionContext_Target) EmitProtobuf(mm *easyproto.MessageMarshale
x.Container.EmitProtobuf(mm.AppendMessage(1)) x.Container.EmitProtobuf(mm.AppendMessage(1))
} }
for i := range x.Objects { for i := range x.Objects {
if x.Objects[i] != nil { x.Objects[i].EmitProtobuf(mm.AppendMessage(2))
x.Objects[i].EmitProtobuf(mm.AppendMessage(2))
}
} }
} }
@ -142,8 +140,8 @@ func (x *ObjectSessionContext_Target) UnmarshalProtobuf(src []byte) (err error)
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Objects") return fmt.Errorf("cannot unmarshal field %s", "Objects")
} }
x.Objects = append(x.Objects, new(grpc.ObjectID)) x.Objects = append(x.Objects, grpc.ObjectID{})
ff := x.Objects[len(x.Objects)-1] ff := &x.Objects[len(x.Objects)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -160,13 +158,13 @@ func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID {
func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) { func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) {
x.Container = v x.Container = v
} }
func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { func (x *ObjectSessionContext_Target) GetObjects() []grpc.ObjectID {
if x != nil { if x != nil {
return x.Objects return x.Objects
} }
return nil return nil
} }
func (x *ObjectSessionContext_Target) SetObjects(v []*grpc.ObjectID) { func (x *ObjectSessionContext_Target) SetObjects(v []grpc.ObjectID) {
x.Objects = v x.Objects = v
} }
@ -236,11 +234,11 @@ func (x *ObjectSessionContext_Target) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "objects": case "objects":
{ {
var f *grpc.ObjectID var f grpc.ObjectID
var list []*grpc.ObjectID var list []grpc.ObjectID
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.ObjectID) f = grpc.ObjectID{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1551,7 +1549,7 @@ type RequestMetaHeader struct {
Version *grpc.Version `json:"version"` Version *grpc.Version `json:"version"`
Epoch uint64 `json:"epoch"` Epoch uint64 `json:"epoch"`
Ttl uint32 `json:"ttl"` Ttl uint32 `json:"ttl"`
XHeaders []*XHeader `json:"xHeaders"` XHeaders []XHeader `json:"xHeaders"`
SessionToken *SessionToken `json:"sessionToken"` SessionToken *SessionToken `json:"sessionToken"`
BearerToken *grpc1.BearerToken `json:"bearerToken"` BearerToken *grpc1.BearerToken `json:"bearerToken"`
Origin *RequestMetaHeader `json:"origin"` Origin *RequestMetaHeader `json:"origin"`
@ -1576,7 +1574,7 @@ func (x *RequestMetaHeader) StableSize() (size int) {
size += proto.UInt64Size(2, x.Epoch) size += proto.UInt64Size(2, x.Epoch)
size += proto.UInt32Size(3, x.Ttl) size += proto.UInt32Size(3, x.Ttl)
for i := range x.XHeaders { for i := range x.XHeaders {
size += proto.NestedStructureSize(4, x.XHeaders[i]) size += proto.NestedStructureSizeUnchecked(4, &x.XHeaders[i])
} }
size += proto.NestedStructureSize(5, x.SessionToken) size += proto.NestedStructureSize(5, x.SessionToken)
size += proto.NestedStructureSize(6, x.BearerToken) size += proto.NestedStructureSize(6, x.BearerToken)
@ -1608,9 +1606,7 @@ func (x *RequestMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint32(3, x.Ttl) mm.AppendUint32(3, x.Ttl)
} }
for i := range x.XHeaders { for i := range x.XHeaders {
if x.XHeaders[i] != nil { x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
}
} }
if x.SessionToken != nil { if x.SessionToken != nil {
x.SessionToken.EmitProtobuf(mm.AppendMessage(5)) x.SessionToken.EmitProtobuf(mm.AppendMessage(5))
@ -1661,8 +1657,8 @@ func (x *RequestMetaHeader) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "XHeaders") return fmt.Errorf("cannot unmarshal field %s", "XHeaders")
} }
x.XHeaders = append(x.XHeaders, new(XHeader)) x.XHeaders = append(x.XHeaders, XHeader{})
ff := x.XHeaders[len(x.XHeaders)-1] ff := &x.XHeaders[len(x.XHeaders)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1730,13 +1726,13 @@ func (x *RequestMetaHeader) GetTtl() uint32 {
func (x *RequestMetaHeader) SetTtl(v uint32) { func (x *RequestMetaHeader) SetTtl(v uint32) {
x.Ttl = v x.Ttl = v
} }
func (x *RequestMetaHeader) GetXHeaders() []*XHeader { func (x *RequestMetaHeader) GetXHeaders() []XHeader {
if x != nil { if x != nil {
return x.XHeaders return x.XHeaders
} }
return nil return nil
} }
func (x *RequestMetaHeader) SetXHeaders(v []*XHeader) { func (x *RequestMetaHeader) SetXHeaders(v []XHeader) {
x.XHeaders = v x.XHeaders = v
} }
func (x *RequestMetaHeader) GetSessionToken() *SessionToken { func (x *RequestMetaHeader) GetSessionToken() *SessionToken {
@ -1884,11 +1880,11 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "xHeaders": case "xHeaders":
{ {
var f *XHeader var f XHeader
var list []*XHeader var list []XHeader
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(XHeader) f = XHeader{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -1936,7 +1932,7 @@ type ResponseMetaHeader struct {
Version *grpc.Version `json:"version"` Version *grpc.Version `json:"version"`
Epoch uint64 `json:"epoch"` Epoch uint64 `json:"epoch"`
Ttl uint32 `json:"ttl"` Ttl uint32 `json:"ttl"`
XHeaders []*XHeader `json:"xHeaders"` XHeaders []XHeader `json:"xHeaders"`
Origin *ResponseMetaHeader `json:"origin"` Origin *ResponseMetaHeader `json:"origin"`
Status *grpc2.Status `json:"status"` Status *grpc2.Status `json:"status"`
} }
@ -1959,7 +1955,7 @@ func (x *ResponseMetaHeader) StableSize() (size int) {
size += proto.UInt64Size(2, x.Epoch) size += proto.UInt64Size(2, x.Epoch)
size += proto.UInt32Size(3, x.Ttl) size += proto.UInt32Size(3, x.Ttl)
for i := range x.XHeaders { for i := range x.XHeaders {
size += proto.NestedStructureSize(4, x.XHeaders[i]) size += proto.NestedStructureSizeUnchecked(4, &x.XHeaders[i])
} }
size += proto.NestedStructureSize(5, x.Origin) size += proto.NestedStructureSize(5, x.Origin)
size += proto.NestedStructureSize(6, x.Status) size += proto.NestedStructureSize(6, x.Status)
@ -1989,9 +1985,7 @@ func (x *ResponseMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint32(3, x.Ttl) mm.AppendUint32(3, x.Ttl)
} }
for i := range x.XHeaders { for i := range x.XHeaders {
if x.XHeaders[i] != nil { x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
}
} }
if x.Origin != nil { if x.Origin != nil {
x.Origin.EmitProtobuf(mm.AppendMessage(5)) x.Origin.EmitProtobuf(mm.AppendMessage(5))
@ -2036,8 +2030,8 @@ func (x *ResponseMetaHeader) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "XHeaders") return fmt.Errorf("cannot unmarshal field %s", "XHeaders")
} }
x.XHeaders = append(x.XHeaders, new(XHeader)) x.XHeaders = append(x.XHeaders, XHeader{})
ff := x.XHeaders[len(x.XHeaders)-1] ff := &x.XHeaders[len(x.XHeaders)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -2090,13 +2084,13 @@ func (x *ResponseMetaHeader) GetTtl() uint32 {
func (x *ResponseMetaHeader) SetTtl(v uint32) { func (x *ResponseMetaHeader) SetTtl(v uint32) {
x.Ttl = v x.Ttl = v
} }
func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { func (x *ResponseMetaHeader) GetXHeaders() []XHeader {
if x != nil { if x != nil {
return x.XHeaders return x.XHeaders
} }
return nil return nil
} }
func (x *ResponseMetaHeader) SetXHeaders(v []*XHeader) { func (x *ResponseMetaHeader) SetXHeaders(v []XHeader) {
x.XHeaders = v x.XHeaders = v
} }
func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader {
@ -2216,11 +2210,11 @@ func (x *ResponseMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "xHeaders": case "xHeaders":
{ {
var f *XHeader var f XHeader
var list []*XHeader var list []XHeader
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(XHeader) f = XHeader{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -48,13 +48,13 @@ func (x *Status) ToGRPCMessage() grpc.Message {
m.SetCode(CodeToGRPC(x.code)) m.SetCode(CodeToGRPC(x.code))
m.SetMessage(x.msg) m.SetMessage(x.msg)
var ds []*status.Status_Detail var ds []status.Status_Detail
if ln := len(x.details); ln > 0 { if ln := len(x.details); ln > 0 {
ds = make([]*status.Status_Detail, 0, ln) ds = make([]status.Status_Detail, 0, ln)
for i := 0; i < ln; i++ { for i := 0; i < ln; i++ {
ds = append(ds, x.details[i].ToGRPCMessage().(*status.Status_Detail)) ds = append(ds, *x.details[i].ToGRPCMessage().(*status.Status_Detail))
} }
} }
@ -81,10 +81,8 @@ func (x *Status) FromGRPCMessage(m grpc.Message) error {
ds = make([]Detail, ln) ds = make([]Detail, ln)
for i := 0; i < ln; i++ { for i := 0; i < ln; i++ {
if dsV2[i] != nil { if err := ds[i].FromGRPCMessage(&dsV2[i]); err != nil {
if err := ds[i].FromGRPCMessage(dsV2[i]); err != nil { return err
return err
}
} }
} }
} }

View file

@ -429,9 +429,9 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type Status struct { type Status struct {
Code uint32 `json:"code"` Code uint32 `json:"code"`
Message string `json:"message"` Message string `json:"message"`
Details []*Status_Detail `json:"details"` Details []Status_Detail `json:"details"`
} }
var ( var (
@ -451,7 +451,7 @@ func (x *Status) StableSize() (size int) {
size += proto.UInt32Size(1, x.Code) size += proto.UInt32Size(1, x.Code)
size += proto.StringSize(2, x.Message) size += proto.StringSize(2, x.Message)
for i := range x.Details { for i := range x.Details {
size += proto.NestedStructureSize(3, x.Details[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Details[i])
} }
return size return size
} }
@ -476,9 +476,7 @@ func (x *Status) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendString(2, x.Message) mm.AppendString(2, x.Message)
} }
for i := range x.Details { for i := range x.Details {
if x.Details[i] != nil { x.Details[i].EmitProtobuf(mm.AppendMessage(3))
x.Details[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
} }
@ -508,8 +506,8 @@ func (x *Status) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Details") return fmt.Errorf("cannot unmarshal field %s", "Details")
} }
x.Details = append(x.Details, new(Status_Detail)) x.Details = append(x.Details, Status_Detail{})
ff := x.Details[len(x.Details)-1] ff := &x.Details[len(x.Details)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -535,13 +533,13 @@ func (x *Status) GetMessage() string {
func (x *Status) SetMessage(v string) { func (x *Status) SetMessage(v string) {
x.Message = v x.Message = v
} }
func (x *Status) GetDetails() []*Status_Detail { func (x *Status) GetDetails() []Status_Detail {
if x != nil { if x != nil {
return x.Details return x.Details
} }
return nil return nil
} }
func (x *Status) SetDetails(v []*Status_Detail) { func (x *Status) SetDetails(v []Status_Detail) {
x.Details = v x.Details = v
} }
@ -621,11 +619,11 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "details": case "details":
{ {
var f *Status_Detail var f Status_Detail
var list []*Status_Detail var list []Status_Detail
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(Status_Detail) f = Status_Detail{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -15,9 +15,9 @@ import (
) )
type Tombstone struct { type Tombstone struct {
ExpirationEpoch uint64 `json:"expirationEpoch"` ExpirationEpoch uint64 `json:"expirationEpoch"`
SplitId []byte `json:"splitID"` SplitId []byte `json:"splitID"`
Members []*grpc.ObjectID `json:"members"` Members []grpc.ObjectID `json:"members"`
} }
var ( var (
@ -37,7 +37,7 @@ func (x *Tombstone) StableSize() (size int) {
size += proto.UInt64Size(1, x.ExpirationEpoch) size += proto.UInt64Size(1, x.ExpirationEpoch)
size += proto.BytesSize(2, x.SplitId) size += proto.BytesSize(2, x.SplitId)
for i := range x.Members { for i := range x.Members {
size += proto.NestedStructureSize(3, x.Members[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Members[i])
} }
return size return size
} }
@ -62,9 +62,7 @@ func (x *Tombstone) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendBytes(2, x.SplitId) mm.AppendBytes(2, x.SplitId)
} }
for i := range x.Members { for i := range x.Members {
if x.Members[i] != nil { x.Members[i].EmitProtobuf(mm.AppendMessage(3))
x.Members[i].EmitProtobuf(mm.AppendMessage(3))
}
} }
} }
@ -94,8 +92,8 @@ func (x *Tombstone) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Members") return fmt.Errorf("cannot unmarshal field %s", "Members")
} }
x.Members = append(x.Members, new(grpc.ObjectID)) x.Members = append(x.Members, grpc.ObjectID{})
ff := x.Members[len(x.Members)-1] ff := &x.Members[len(x.Members)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -121,13 +119,13 @@ func (x *Tombstone) GetSplitId() []byte {
func (x *Tombstone) SetSplitId(v []byte) { func (x *Tombstone) SetSplitId(v []byte) {
x.SplitId = v x.SplitId = v
} }
func (x *Tombstone) GetMembers() []*grpc.ObjectID { func (x *Tombstone) GetMembers() []grpc.ObjectID {
if x != nil { if x != nil {
return x.Members return x.Members
} }
return nil return nil
} }
func (x *Tombstone) SetMembers(v []*grpc.ObjectID) { func (x *Tombstone) SetMembers(v []grpc.ObjectID) {
x.Members = v x.Members = v
} }
@ -207,11 +205,11 @@ func (x *Tombstone) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "members": case "members":
{ {
var f *grpc.ObjectID var f grpc.ObjectID
var list []*grpc.ObjectID var list []grpc.ObjectID
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(grpc.ObjectID) f = grpc.ObjectID{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -133,10 +133,10 @@ func randIntSlice[T protoInt](n int, includeZero bool) []T {
return r return r
} }
func uint32SliceToAux(s []uint32) []*generated.RepPrimitives_Aux { func uint32SliceToAux(s []uint32) []generated.RepPrimitives_Aux {
r := make([]*generated.RepPrimitives_Aux, len(s)) r := make([]generated.RepPrimitives_Aux, len(s))
for i := range s { for i := range s {
r[i] = &generated.RepPrimitives_Aux{s[i]} r[i] = generated.RepPrimitives_Aux{InnerField: s[i]}
} }
return r return r
} }

View file

@ -932,14 +932,14 @@ func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type RepPrimitives struct { type RepPrimitives struct {
FieldA [][]byte `json:"fieldA"` FieldA [][]byte `json:"fieldA"`
FieldB []string `json:"fieldB"` FieldB []string `json:"fieldB"`
FieldC []int32 `json:"fieldC"` FieldC []int32 `json:"fieldC"`
FieldD []uint32 `json:"fieldD"` FieldD []uint32 `json:"fieldD"`
FieldE []int64 `json:"fieldE"` FieldE []int64 `json:"fieldE"`
FieldF []uint64 `json:"fieldF"` FieldF []uint64 `json:"fieldF"`
FieldFu []uint64 `json:"fieldFu"` FieldFu []uint64 `json:"fieldFu"`
FieldAux []*RepPrimitives_Aux `json:"fieldAux"` FieldAux []RepPrimitives_Aux `json:"fieldAux"`
} }
var ( var (
@ -971,7 +971,7 @@ func (x *RepPrimitives) StableSize() (size int) {
size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i]))
} }
for i := range x.FieldAux { for i := range x.FieldAux {
size += proto.NestedStructureSize(8, x.FieldAux[i]) size += proto.NestedStructureSizeUnchecked(8, &x.FieldAux[i])
} }
return size return size
} }
@ -1011,9 +1011,7 @@ func (x *RepPrimitives) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint64(7, x.FieldFu[j]) mm.AppendUint64(7, x.FieldFu[j])
} }
for i := range x.FieldAux { for i := range x.FieldAux {
if x.FieldAux[i] != nil { x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8))
x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8))
}
} }
} }
@ -1073,8 +1071,8 @@ func (x *RepPrimitives) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "FieldAux") return fmt.Errorf("cannot unmarshal field %s", "FieldAux")
} }
x.FieldAux = append(x.FieldAux, new(RepPrimitives_Aux)) x.FieldAux = append(x.FieldAux, RepPrimitives_Aux{})
ff := x.FieldAux[len(x.FieldAux)-1] ff := &x.FieldAux[len(x.FieldAux)-1]
if err := ff.UnmarshalProtobuf(data); err != nil { if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err) return fmt.Errorf("unmarshal: %w", err)
} }
@ -1145,13 +1143,13 @@ func (x *RepPrimitives) GetFieldFu() []uint64 {
func (x *RepPrimitives) SetFieldFu(v []uint64) { func (x *RepPrimitives) SetFieldFu(v []uint64) {
x.FieldFu = v x.FieldFu = v
} }
func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux { func (x *RepPrimitives) GetFieldAux() []RepPrimitives_Aux {
if x != nil { if x != nil {
return x.FieldAux return x.FieldAux
} }
return nil return nil
} }
func (x *RepPrimitives) SetFieldAux(v []*RepPrimitives_Aux) { func (x *RepPrimitives) SetFieldAux(v []RepPrimitives_Aux) {
x.FieldAux = v x.FieldAux = v
} }
@ -1384,11 +1382,11 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "fieldAux": case "fieldAux":
{ {
var f *RepPrimitives_Aux var f RepPrimitives_Aux
var list []*RepPrimitives_Aux var list []RepPrimitives_Aux
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(RepPrimitives_Aux) f = RepPrimitives_Aux{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -117,7 +117,7 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string
template = "%s = in.Bytes()" template = "%s = in.Bytes()"
case protoreflect.MessageKind: case protoreflect.MessageKind:
if f.Desc.IsList() { if f.Desc.IsList() {
g.P("f = new(", fieldType(g, f)[3:], ")") g.P("f = ", fieldType(g, f)[2:], "{}")
} else { } else {
g.P("f = new(", fieldType(g, f)[1:], ")") g.P("f = new(", fieldType(g, f)[1:], ")")
} }

View file

@ -39,8 +39,8 @@ func emitFieldUnmarshal(g *protogen.GeneratedFile, f *protogen.Field) {
g.P("data, ok := fc.MessageData()") g.P("data, ok := fc.MessageData()")
g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`)
if f.Desc.IsList() { if f.Desc.IsList() {
g.P(name, " = append(", name, ", new(", fieldType(g, f)[3:], "))") g.P(name, " = append(", name, ", ", fieldType(g, f)[2:], "{})")
g.P("ff := ", name, "[len(", name, ")-1]") g.P("ff := &", name, "[len(", name, ")-1]")
name = "ff" name = "ff"
} else if f.Oneof != nil { } else if f.Oneof != nil {
const tmp = "oneofField" const tmp = "oneofField"
@ -172,11 +172,12 @@ func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) {
defer g.P("}") defer g.P("}")
name += "[i]" name += "[i]"
} else {
g.P("if ", notNil(name), " {")
defer g.P("}")
} }
g.P("if ", notNil(name), " {")
g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))") g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))")
g.P("}")
return return
} }

View file

@ -43,7 +43,10 @@ func fieldType(g *protogen.GeneratedFile, field *protogen.Field) structField {
case protoreflect.BytesKind: case protoreflect.BytesKind:
typ = "[]byte" typ = "[]byte"
case protoreflect.MessageKind: case protoreflect.MessageKind:
typ = structField(g.QualifiedGoIdent(field.Message.GoIdent)).PointerTo() typ = structField(g.QualifiedGoIdent(field.Message.GoIdent))
if !field.Desc.IsList() {
typ = typ.PointerTo()
}
case protoreflect.GroupKind: case protoreflect.GroupKind:
panic("unimplemented") panic("unimplemented")
} }

View file

@ -72,7 +72,7 @@ func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) {
case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()):
g.P("for i := range ", name, "{") g.P("for i := range ", name, "{")
if f.Desc.Kind() == protoreflect.MessageKind { if f.Desc.Kind() == protoreflect.MessageKind {
g.P("size += ", protoPackage.Ident("NestedStructureSize"), "(", f.Desc.Number(), ", ", name, "[i])") g.P("size += ", protoPackage.Ident("NestedStructureSizeUnchecked"), "(", f.Desc.Number(), ", &", name, "[i])")
} else { } else {
if f.Desc.Kind() != protoreflect.Uint64Kind { if f.Desc.Kind() != protoreflect.Uint64Kind {
panic("only uint64 unpacked primitive is supported") panic("only uint64 unpacked primitive is supported")