[#1343] go.mod: Update api-go

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-08-29 15:45:33 +03:00 committed by Evgenii Stratonikov
parent 882c068410
commit 98fe24cdb7
13 changed files with 180 additions and 206 deletions

View file

@ -61,7 +61,7 @@ func listShards(cmd *cobra.Command, _ []string) {
} }
} }
func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) { func prettyPrintShardsJSON(cmd *cobra.Command, ii []control.ShardInfo) {
out := make([]map[string]any, 0, len(ii)) out := make([]map[string]any, 0, len(ii))
for _, i := range ii { for _, i := range ii {
out = append(out, map[string]any{ out = append(out, map[string]any{
@ -83,7 +83,7 @@ func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) {
cmd.Print(buf.String()) // pretty printer emits newline, so no need for Println cmd.Print(buf.String()) // pretty printer emits newline, so no need for Println
} }
func prettyPrintShards(cmd *cobra.Command, ii []*control.ShardInfo) { func prettyPrintShards(cmd *cobra.Command, ii []control.ShardInfo) {
for _, i := range ii { for _, i := range ii {
pathPrinter := func(name, path string) string { pathPrinter := func(name, path string) string {
if path == "" { if path == "" {
@ -121,7 +121,7 @@ func shardModeToString(m control.ShardMode) string {
return "unknown" return "unknown"
} }
func sortShardsByID(ii []*control.ShardInfo) { func sortShardsByID(ii []control.ShardInfo) {
sort.Slice(ii, func(i, j int) bool { sort.Slice(ii, func(i, j int) bool {
return bytes.Compare(ii[i].GetShard_ID(), ii[j].GetShard_ID()) < 0 return bytes.Compare(ii[i].GetShard_ID(), ii[j].GetShard_ID()) < 0
}) })

View file

@ -77,13 +77,13 @@ func add(cmd *cobra.Command, _ []string) {
cmd.Println("Node ID: ", resp.GetBody().GetNodeId()) cmd.Println("Node ID: ", resp.GetBody().GetNodeId())
} }
func parseMeta(cmd *cobra.Command) ([]*tree.KeyValue, error) { func parseMeta(cmd *cobra.Command) ([]tree.KeyValue, error) {
raws, _ := cmd.Flags().GetStringSlice(metaFlagKey) raws, _ := cmd.Flags().GetStringSlice(metaFlagKey)
if len(raws) == 0 { if len(raws) == 0 {
return nil, nil return nil, nil
} }
pairs := make([]*tree.KeyValue, 0, len(raws)) pairs := make([]tree.KeyValue, 0, len(raws))
for i := range raws { for i := range raws {
k, v, found := strings.Cut(raws[i], "=") k, v, found := strings.Cut(raws[i], "=")
if !found { if !found {
@ -94,7 +94,7 @@ func parseMeta(cmd *cobra.Command) ([]*tree.KeyValue, error) {
pair.Key = k pair.Key = k
pair.Value = []byte(v) pair.Value = []byte(v)
pairs = append(pairs, &pair) pairs = append(pairs, pair)
} }
return pairs, nil return pairs, nil

View file

@ -75,7 +75,7 @@ func move(cmd *cobra.Command, _ []string) {
resp, err := cli.GetSubTree(ctx, subTreeReq) resp, err := cli.GetSubTree(ctx, subTreeReq)
commonCmd.ExitOnErr(cmd, "rpc call: %w", err) commonCmd.ExitOnErr(cmd, "rpc call: %w", err)
var meta []*tree.KeyValue var meta []tree.KeyValue
subtreeResp, err := resp.Recv() subtreeResp, err := resp.Recv()
for ; err == nil; subtreeResp, err = resp.Recv() { for ; err == nil; subtreeResp, err = resp.Recv() {
meta = subtreeResp.GetBody().GetMeta() meta = subtreeResp.GetBody().GetMeta()

2
go.mod
View file

@ -4,7 +4,7 @@ go 1.22
require ( require (
code.gitea.io/sdk/gitea v0.17.1 code.gitea.io/sdk/gitea v0.17.1
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240827104600-eba18f6e67ac git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240828085308-5e1c6a908f61
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0
git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d

4
go.sum
View file

@ -1,7 +1,7 @@
code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8= code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8=
code.gitea.io/sdk/gitea v0.17.1/go.mod h1:aCnBqhHpoEWA180gMbaCtdX9Pl6BWBAuuP2miadoTNM= code.gitea.io/sdk/gitea v0.17.1/go.mod h1:aCnBqhHpoEWA180gMbaCtdX9Pl6BWBAuuP2miadoTNM=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240827104600-eba18f6e67ac h1:Gu3oiPnsSZPgwsUYs2f3xTQwndM/OWM/zo3zbN4rOb8= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240828085308-5e1c6a908f61 h1:bw9EVGWnfY9awFb5XYR52AGbzgg3o04gZF66yHob48c=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240827104600-eba18f6e67ac/go.mod h1:BDnEpkKMykCS8u1nLzR6SgNzCv6885RWlo5TnravQuI= git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240828085308-5e1c6a908f61/go.mod h1:BDnEpkKMykCS8u1nLzR6SgNzCv6885RWlo5TnravQuI=
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e h1:kcBqZBiFIUBATUqEuvVigtkJJWQ2Gug/eYXn967o3M4= git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e h1:kcBqZBiFIUBATUqEuvVigtkJJWQ2Gug/eYXn967o3M4=
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc= git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc=
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=

View file

@ -25,7 +25,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) (
info := s.s.DumpInfo() info := s.s.DumpInfo()
shardInfos := make([]*control.ShardInfo, 0, len(info.Shards)) shardInfos := make([]control.ShardInfo, 0, len(info.Shards))
for _, sh := range info.Shards { for _, sh := range info.Shards {
si := new(control.ShardInfo) si := new(control.ShardInfo)
@ -54,7 +54,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) (
si.SetMode(m) si.SetMode(m)
si.SetErrorCount(sh.ErrorCount) si.SetErrorCount(sh.ErrorCount)
shardInfos = append(shardInfos, si) shardInfos = append(shardInfos, *si)
} }
body.SetShards(shardInfos) body.SetShards(shardInfos)
@ -67,10 +67,10 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) (
return resp, nil return resp, nil
} }
func blobstorInfoToProto(info blobstor.Info) []*control.BlobstorInfo { func blobstorInfoToProto(info blobstor.Info) []control.BlobstorInfo {
res := make([]*control.BlobstorInfo, len(info.SubStorages)) res := make([]control.BlobstorInfo, len(info.SubStorages))
for i := range info.SubStorages { for i := range info.SubStorages {
res[i] = &control.BlobstorInfo{ res[i] = control.BlobstorInfo{
Path: info.SubStorages[i].Path, Path: info.SubStorages[i].Path,
Type: info.SubStorages[i].Type, Type: info.SubStorages[i].Type,
} }

View file

@ -220,13 +220,13 @@ func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListT
if err != nil { if err != nil {
return nil, status.Error(getCodeByLocalStorageErr(err), err.Error()) return nil, status.Error(getCodeByLocalStorageErr(err), err.Error())
} }
targets := make([]*control.ChainTarget, 0, len(apeTargets)) targets := make([]control.ChainTarget, 0, len(apeTargets))
for i := range apeTargets { for i := range apeTargets {
target, err := controlTarget(&apeTargets[i]) target, err := controlTarget(&apeTargets[i])
if err != nil { if err != nil {
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
targets = append(targets, &target) targets = append(targets, target)
} }
resp := &control.ListTargetsLocalOverridesResponse{ resp := &control.ListTargetsLocalOverridesResponse{

View file

@ -32,12 +32,12 @@ func (s *Server) SealWriteCache(ctx context.Context, req *control.SealWriteCache
resp := &control.SealWriteCacheResponse{Body: &control.SealWriteCacheResponse_Body{}} resp := &control.SealWriteCacheResponse{Body: &control.SealWriteCacheResponse_Body{}}
for _, r := range res.ShardResults { for _, r := range res.ShardResults {
if r.Success { if r.Success {
resp.Body.Results = append(resp.GetBody().GetResults(), &control.SealWriteCacheResponse_Body_Status{ resp.Body.Results = append(resp.GetBody().GetResults(), control.SealWriteCacheResponse_Body_Status{
Shard_ID: *r.ShardID, Shard_ID: *r.ShardID,
Success: true, Success: true,
}) })
} else { } else {
resp.Body.Results = append(resp.GetBody().GetResults(), &control.SealWriteCacheResponse_Body_Status{ resp.Body.Results = append(resp.GetBody().GetResults(), control.SealWriteCacheResponse_Body_Status{
Shard_ID: *r.ShardID, Shard_ID: *r.ShardID,
Error: r.ErrorMsg, Error: r.ErrorMsg,
}) })

View file

@ -2851,7 +2851,7 @@ func (x *ListShardsRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type ListShardsResponse_Body struct { type ListShardsResponse_Body struct {
Shards []*ShardInfo `json:"shards"` Shards []ShardInfo `json:"shards"`
} }
var ( var (
@ -2869,7 +2869,7 @@ func (x *ListShardsResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Shards { for i := range x.Shards {
size += proto.NestedStructureSize(1, x.Shards[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Shards[i])
} }
return size return size
} }
@ -2888,11 +2888,9 @@ func (x *ListShardsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
return return
} }
for i := range x.Shards { for i := range x.Shards {
if x.Shards[i] != nil {
x.Shards[i].EmitProtobuf(mm.AppendMessage(1)) x.Shards[i].EmitProtobuf(mm.AppendMessage(1))
} }
} }
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *ListShardsResponse_Body) UnmarshalProtobuf(src []byte) (err error) { func (x *ListShardsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
@ -2908,8 +2906,8 @@ func (x *ListShardsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Shards") return fmt.Errorf("cannot unmarshal field %s", "Shards")
} }
x.Shards = append(x.Shards, new(ShardInfo)) x.Shards = append(x.Shards, ShardInfo{})
ff := x.Shards[len(x.Shards)-1] ff := &x.Shards[len(x.Shards)-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)
} }
@ -2917,13 +2915,13 @@ func (x *ListShardsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *ListShardsResponse_Body) GetShards() []*ShardInfo { func (x *ListShardsResponse_Body) GetShards() []ShardInfo {
if x != nil { if x != nil {
return x.Shards return x.Shards
} }
return nil return nil
} }
func (x *ListShardsResponse_Body) SetShards(v []*ShardInfo) { func (x *ListShardsResponse_Body) SetShards(v []ShardInfo) {
x.Shards = v x.Shards = v
} }
@ -2981,11 +2979,11 @@ func (x *ListShardsResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "shards": case "shards":
{ {
var f *ShardInfo var f ShardInfo
var list []*ShardInfo var list []ShardInfo
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(ShardInfo) f = ShardInfo{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -11870,7 +11868,7 @@ func (x *ListTargetsLocalOverridesRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type ListTargetsLocalOverridesResponse_Body struct { type ListTargetsLocalOverridesResponse_Body struct {
Targets []*ChainTarget `json:"targets"` Targets []ChainTarget `json:"targets"`
} }
var ( var (
@ -11888,7 +11886,7 @@ func (x *ListTargetsLocalOverridesResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Targets { for i := range x.Targets {
size += proto.NestedStructureSize(1, x.Targets[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Targets[i])
} }
return size return size
} }
@ -11907,11 +11905,9 @@ func (x *ListTargetsLocalOverridesResponse_Body) EmitProtobuf(mm *easyproto.Mess
return return
} }
for i := range x.Targets { for i := range x.Targets {
if x.Targets[i] != nil {
x.Targets[i].EmitProtobuf(mm.AppendMessage(1)) x.Targets[i].EmitProtobuf(mm.AppendMessage(1))
} }
} }
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalProtobuf(src []byte) (err error) { func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
@ -11927,8 +11923,8 @@ func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalProtobuf(src []byte) (
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(ChainTarget)) x.Targets = append(x.Targets, ChainTarget{})
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)
} }
@ -11936,13 +11932,13 @@ func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalProtobuf(src []byte) (
} }
return nil return nil
} }
func (x *ListTargetsLocalOverridesResponse_Body) GetTargets() []*ChainTarget { func (x *ListTargetsLocalOverridesResponse_Body) GetTargets() []ChainTarget {
if x != nil { if x != nil {
return x.Targets return x.Targets
} }
return nil return nil
} }
func (x *ListTargetsLocalOverridesResponse_Body) SetTargets(v []*ChainTarget) { func (x *ListTargetsLocalOverridesResponse_Body) SetTargets(v []ChainTarget) {
x.Targets = v x.Targets = v
} }
@ -12000,11 +11996,11 @@ func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalEasyJSON(in *jlexer.Le
switch key { switch key {
case "targets": case "targets":
{ {
var f *ChainTarget var f ChainTarget
var list []*ChainTarget var list []ChainTarget
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(ChainTarget) f = ChainTarget{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -14083,7 +14079,7 @@ func (x *SealWriteCacheResponse_Body_Status) UnmarshalEasyJSON(in *jlexer.Lexer)
} }
type SealWriteCacheResponse_Body struct { type SealWriteCacheResponse_Body struct {
Results []*SealWriteCacheResponse_Body_Status `json:"results"` Results []SealWriteCacheResponse_Body_Status `json:"results"`
} }
var ( var (
@ -14101,7 +14097,7 @@ func (x *SealWriteCacheResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Results { for i := range x.Results {
size += proto.NestedStructureSize(1, x.Results[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Results[i])
} }
return size return size
} }
@ -14120,11 +14116,9 @@ func (x *SealWriteCacheResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshale
return return
} }
for i := range x.Results { for i := range x.Results {
if x.Results[i] != nil {
x.Results[i].EmitProtobuf(mm.AppendMessage(1)) x.Results[i].EmitProtobuf(mm.AppendMessage(1))
} }
} }
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *SealWriteCacheResponse_Body) UnmarshalProtobuf(src []byte) (err error) { func (x *SealWriteCacheResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
@ -14140,8 +14134,8 @@ func (x *SealWriteCacheResponse_Body) UnmarshalProtobuf(src []byte) (err error)
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Results") return fmt.Errorf("cannot unmarshal field %s", "Results")
} }
x.Results = append(x.Results, new(SealWriteCacheResponse_Body_Status)) x.Results = append(x.Results, SealWriteCacheResponse_Body_Status{})
ff := x.Results[len(x.Results)-1] ff := &x.Results[len(x.Results)-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)
} }
@ -14149,13 +14143,13 @@ func (x *SealWriteCacheResponse_Body) UnmarshalProtobuf(src []byte) (err error)
} }
return nil return nil
} }
func (x *SealWriteCacheResponse_Body) GetResults() []*SealWriteCacheResponse_Body_Status { func (x *SealWriteCacheResponse_Body) GetResults() []SealWriteCacheResponse_Body_Status {
if x != nil { if x != nil {
return x.Results return x.Results
} }
return nil return nil
} }
func (x *SealWriteCacheResponse_Body) SetResults(v []*SealWriteCacheResponse_Body_Status) { func (x *SealWriteCacheResponse_Body) SetResults(v []SealWriteCacheResponse_Body_Status) {
x.Results = v x.Results = v
} }
@ -14213,11 +14207,11 @@ func (x *SealWriteCacheResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "results": case "results":
{ {
var f *SealWriteCacheResponse_Body_Status var f SealWriteCacheResponse_Body_Status
var list []*SealWriteCacheResponse_Body_Status var list []SealWriteCacheResponse_Body_Status
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(SealWriteCacheResponse_Body_Status) f = SealWriteCacheResponse_Body_Status{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -502,7 +502,7 @@ 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 NetmapStatus `json:"state"` State NetmapStatus `json:"state"`
} }
@ -523,7 +523,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
@ -549,10 +549,8 @@ 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))
} }
@ -584,8 +582,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)
} }
@ -617,13 +615,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() NetmapStatus { func (x *NodeInfo) GetState() NetmapStatus {
@ -731,11 +729,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()
@ -776,7 +774,7 @@ 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 (
@ -795,7 +793,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
} }
@ -817,11 +815,9 @@ 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))
} }
} }
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *Netmap) UnmarshalProtobuf(src []byte) (err error) { func (x *Netmap) UnmarshalProtobuf(src []byte) (err error) {
@ -843,8 +839,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)
} }
@ -861,13 +857,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
} }
@ -936,11 +932,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()
@ -960,7 +956,7 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) {
type ShardInfo struct { type ShardInfo struct {
Shard_ID []byte `json:"shardID"` Shard_ID []byte `json:"shardID"`
MetabasePath string `json:"metabasePath"` MetabasePath string `json:"metabasePath"`
Blobstor []*BlobstorInfo `json:"blobstor"` Blobstor []BlobstorInfo `json:"blobstor"`
WritecachePath string `json:"writecachePath"` WritecachePath string `json:"writecachePath"`
Mode ShardMode `json:"mode"` Mode ShardMode `json:"mode"`
ErrorCount uint32 `json:"errorCount"` ErrorCount uint32 `json:"errorCount"`
@ -984,7 +980,7 @@ func (x *ShardInfo) StableSize() (size int) {
size += proto.BytesSize(1, x.Shard_ID) size += proto.BytesSize(1, x.Shard_ID)
size += proto.StringSize(2, x.MetabasePath) size += proto.StringSize(2, x.MetabasePath)
for i := range x.Blobstor { for i := range x.Blobstor {
size += proto.NestedStructureSize(3, x.Blobstor[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Blobstor[i])
} }
size += proto.StringSize(4, x.WritecachePath) size += proto.StringSize(4, x.WritecachePath)
size += proto.EnumSize(5, int32(x.Mode)) size += proto.EnumSize(5, int32(x.Mode))
@ -1013,10 +1009,8 @@ func (x *ShardInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendString(2, x.MetabasePath) mm.AppendString(2, x.MetabasePath)
} }
for i := range x.Blobstor { for i := range x.Blobstor {
if x.Blobstor[i] != nil {
x.Blobstor[i].EmitProtobuf(mm.AppendMessage(3)) x.Blobstor[i].EmitProtobuf(mm.AppendMessage(3))
} }
}
if len(x.WritecachePath) != 0 { if len(x.WritecachePath) != 0 {
mm.AppendString(4, x.WritecachePath) mm.AppendString(4, x.WritecachePath)
} }
@ -1057,8 +1051,8 @@ func (x *ShardInfo) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Blobstor") return fmt.Errorf("cannot unmarshal field %s", "Blobstor")
} }
x.Blobstor = append(x.Blobstor, new(BlobstorInfo)) x.Blobstor = append(x.Blobstor, BlobstorInfo{})
ff := x.Blobstor[len(x.Blobstor)-1] ff := &x.Blobstor[len(x.Blobstor)-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)
} }
@ -1108,13 +1102,13 @@ func (x *ShardInfo) GetMetabasePath() string {
func (x *ShardInfo) SetMetabasePath(v string) { func (x *ShardInfo) SetMetabasePath(v string) {
x.MetabasePath = v x.MetabasePath = v
} }
func (x *ShardInfo) GetBlobstor() []*BlobstorInfo { func (x *ShardInfo) GetBlobstor() []BlobstorInfo {
if x != nil { if x != nil {
return x.Blobstor return x.Blobstor
} }
return nil return nil
} }
func (x *ShardInfo) SetBlobstor(v []*BlobstorInfo) { func (x *ShardInfo) SetBlobstor(v []BlobstorInfo) {
x.Blobstor = v x.Blobstor = v
} }
func (x *ShardInfo) GetWritecachePath() string { func (x *ShardInfo) GetWritecachePath() string {
@ -1250,11 +1244,11 @@ func (x *ShardInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "blobstor": case "blobstor":
{ {
var f *BlobstorInfo var f BlobstorInfo
var list []*BlobstorInfo var list []BlobstorInfo
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(BlobstorInfo) f = BlobstorInfo{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -360,7 +360,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
return nil, err return nil, err
} }
info := make([]*GetNodeByPathResponse_Info, 0, len(nodes)) info := make([]GetNodeByPathResponse_Info, 0, len(nodes))
for _, node := range nodes { for _, node := range nodes {
m, parent, err := s.forest.TreeGetMeta(ctx, cid, b.GetTreeId(), node) m, parent, err := s.forest.TreeGetMeta(ctx, cid, b.GetTreeId(), node)
if err != nil { if err != nil {
@ -374,11 +374,11 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
if b.GetAllAttributes() { if b.GetAllAttributes() {
x.Meta = metaToProto(m.Items) x.Meta = metaToProto(m.Items)
} else { } else {
var metaValue []*KeyValue var metaValue []KeyValue
for _, kv := range m.Items { for _, kv := range m.Items {
for _, attr := range b.GetAttributes() { for _, attr := range b.GetAttributes() {
if kv.Key == attr { if kv.Key == attr {
metaValue = append(metaValue, &KeyValue{ metaValue = append(metaValue, KeyValue{
Key: kv.Key, Key: kv.Key,
Value: kv.Value, Value: kv.Value,
}) })
@ -388,7 +388,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
} }
x.Meta = metaValue x.Meta = metaValue
} }
info = append(info, &x) info = append(info, x)
} }
return &GetNodeByPathResponse{ return &GetNodeByPathResponse{
@ -782,21 +782,19 @@ func (s *Service) TreeList(ctx context.Context, req *TreeListRequest) (*TreeList
}, nil }, nil
} }
func protoToMeta(arr []*KeyValue) []pilorama.KeyValue { func protoToMeta(arr []KeyValue) []pilorama.KeyValue {
meta := make([]pilorama.KeyValue, len(arr)) meta := make([]pilorama.KeyValue, len(arr))
for i, kv := range arr { for i, kv := range arr {
if kv != nil {
meta[i].Key = kv.GetKey() meta[i].Key = kv.GetKey()
meta[i].Value = kv.GetValue() meta[i].Value = kv.GetValue()
} }
}
return meta return meta
} }
func metaToProto(arr []pilorama.KeyValue) []*KeyValue { func metaToProto(arr []pilorama.KeyValue) []KeyValue {
meta := make([]*KeyValue, len(arr)) meta := make([]KeyValue, len(arr))
for i, kv := range arr { for i, kv := range arr {
meta[i] = &KeyValue{ meta[i] = KeyValue{
Key: kv.Key, Key: kv.Key,
Value: kv.Value, Value: kv.Value,
} }

View file

@ -19,7 +19,7 @@ type AddRequest_Body struct {
ContainerId []byte `json:"containerId"` ContainerId []byte `json:"containerId"`
TreeId string `json:"treeId"` TreeId string `json:"treeId"`
ParentId uint64 `json:"parentId"` ParentId uint64 `json:"parentId"`
Meta []*KeyValue `json:"meta"` Meta []KeyValue `json:"meta"`
BearerToken []byte `json:"bearerToken"` BearerToken []byte `json:"bearerToken"`
} }
@ -41,7 +41,7 @@ func (x *AddRequest_Body) StableSize() (size int) {
size += proto.StringSize(2, x.TreeId) size += proto.StringSize(2, x.TreeId)
size += proto.UInt64Size(3, x.ParentId) size += proto.UInt64Size(3, x.ParentId)
for i := range x.Meta { for i := range x.Meta {
size += proto.NestedStructureSize(4, x.Meta[i]) size += proto.NestedStructureSizeUnchecked(4, &x.Meta[i])
} }
size += proto.BytesSize(5, x.BearerToken) size += proto.BytesSize(5, x.BearerToken)
return size return size
@ -70,10 +70,8 @@ func (x *AddRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint64(3, x.ParentId) mm.AppendUint64(3, x.ParentId)
} }
for i := range x.Meta { for i := range x.Meta {
if x.Meta[i] != nil {
x.Meta[i].EmitProtobuf(mm.AppendMessage(4)) x.Meta[i].EmitProtobuf(mm.AppendMessage(4))
} }
}
if len(x.BearerToken) != 0 { if len(x.BearerToken) != 0 {
mm.AppendBytes(5, x.BearerToken) mm.AppendBytes(5, x.BearerToken)
} }
@ -111,8 +109,8 @@ func (x *AddRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Meta") return fmt.Errorf("cannot unmarshal field %s", "Meta")
} }
x.Meta = append(x.Meta, new(KeyValue)) x.Meta = append(x.Meta, KeyValue{})
ff := x.Meta[len(x.Meta)-1] ff := &x.Meta[len(x.Meta)-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)
} }
@ -153,13 +151,13 @@ func (x *AddRequest_Body) GetParentId() uint64 {
func (x *AddRequest_Body) SetParentId(v uint64) { func (x *AddRequest_Body) SetParentId(v uint64) {
x.ParentId = v x.ParentId = v
} }
func (x *AddRequest_Body) GetMeta() []*KeyValue { func (x *AddRequest_Body) GetMeta() []KeyValue {
if x != nil { if x != nil {
return x.Meta return x.Meta
} }
return nil return nil
} }
func (x *AddRequest_Body) SetMeta(v []*KeyValue) { func (x *AddRequest_Body) SetMeta(v []KeyValue) {
x.Meta = v x.Meta = v
} }
func (x *AddRequest_Body) GetBearerToken() []byte { func (x *AddRequest_Body) GetBearerToken() []byte {
@ -264,11 +262,11 @@ func (x *AddRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "meta": case "meta":
{ {
var f *KeyValue var f KeyValue
var list []*KeyValue var list []KeyValue
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(KeyValue) f = KeyValue{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -797,7 +795,7 @@ type AddByPathRequest_Body struct {
TreeId string `json:"treeId"` TreeId string `json:"treeId"`
PathAttribute string `json:"pathAttribute"` PathAttribute string `json:"pathAttribute"`
Path []string `json:"path"` Path []string `json:"path"`
Meta []*KeyValue `json:"meta"` Meta []KeyValue `json:"meta"`
BearerToken []byte `json:"bearerToken"` BearerToken []byte `json:"bearerToken"`
} }
@ -820,7 +818,7 @@ func (x *AddByPathRequest_Body) StableSize() (size int) {
size += proto.StringSize(3, x.PathAttribute) size += proto.StringSize(3, x.PathAttribute)
size += proto.RepeatedStringSize(4, x.Path) size += proto.RepeatedStringSize(4, x.Path)
for i := range x.Meta { for i := range x.Meta {
size += proto.NestedStructureSize(5, x.Meta[i]) size += proto.NestedStructureSizeUnchecked(5, &x.Meta[i])
} }
size += proto.BytesSize(6, x.BearerToken) size += proto.BytesSize(6, x.BearerToken)
return size return size
@ -852,10 +850,8 @@ func (x *AddByPathRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendString(4, x.Path[j]) mm.AppendString(4, x.Path[j])
} }
for i := range x.Meta { for i := range x.Meta {
if x.Meta[i] != nil {
x.Meta[i].EmitProtobuf(mm.AppendMessage(5)) x.Meta[i].EmitProtobuf(mm.AppendMessage(5))
} }
}
if len(x.BearerToken) != 0 { if len(x.BearerToken) != 0 {
mm.AppendBytes(6, x.BearerToken) mm.AppendBytes(6, x.BearerToken)
} }
@ -899,8 +895,8 @@ func (x *AddByPathRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Meta") return fmt.Errorf("cannot unmarshal field %s", "Meta")
} }
x.Meta = append(x.Meta, new(KeyValue)) x.Meta = append(x.Meta, KeyValue{})
ff := x.Meta[len(x.Meta)-1] ff := &x.Meta[len(x.Meta)-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)
} }
@ -950,13 +946,13 @@ func (x *AddByPathRequest_Body) GetPath() []string {
func (x *AddByPathRequest_Body) SetPath(v []string) { func (x *AddByPathRequest_Body) SetPath(v []string) {
x.Path = v x.Path = v
} }
func (x *AddByPathRequest_Body) GetMeta() []*KeyValue { func (x *AddByPathRequest_Body) GetMeta() []KeyValue {
if x != nil { if x != nil {
return x.Meta return x.Meta
} }
return nil return nil
} }
func (x *AddByPathRequest_Body) SetMeta(v []*KeyValue) { func (x *AddByPathRequest_Body) SetMeta(v []KeyValue) {
x.Meta = v x.Meta = v
} }
func (x *AddByPathRequest_Body) GetBearerToken() []byte { func (x *AddByPathRequest_Body) GetBearerToken() []byte {
@ -1086,11 +1082,11 @@ func (x *AddByPathRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "meta": case "meta":
{ {
var f *KeyValue var f KeyValue
var list []*KeyValue var list []KeyValue
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(KeyValue) f = KeyValue{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -2355,7 +2351,7 @@ type MoveRequest_Body struct {
TreeId string `json:"treeId"` TreeId string `json:"treeId"`
ParentId uint64 `json:"parentId"` ParentId uint64 `json:"parentId"`
NodeId uint64 `json:"nodeId"` NodeId uint64 `json:"nodeId"`
Meta []*KeyValue `json:"meta"` Meta []KeyValue `json:"meta"`
BearerToken []byte `json:"bearerToken"` BearerToken []byte `json:"bearerToken"`
} }
@ -2378,7 +2374,7 @@ func (x *MoveRequest_Body) StableSize() (size int) {
size += proto.UInt64Size(3, x.ParentId) size += proto.UInt64Size(3, x.ParentId)
size += proto.UInt64Size(4, x.NodeId) size += proto.UInt64Size(4, x.NodeId)
for i := range x.Meta { for i := range x.Meta {
size += proto.NestedStructureSize(5, x.Meta[i]) size += proto.NestedStructureSizeUnchecked(5, &x.Meta[i])
} }
size += proto.BytesSize(6, x.BearerToken) size += proto.BytesSize(6, x.BearerToken)
return size return size
@ -2410,10 +2406,8 @@ func (x *MoveRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint64(4, x.NodeId) mm.AppendUint64(4, x.NodeId)
} }
for i := range x.Meta { for i := range x.Meta {
if x.Meta[i] != nil {
x.Meta[i].EmitProtobuf(mm.AppendMessage(5)) x.Meta[i].EmitProtobuf(mm.AppendMessage(5))
} }
}
if len(x.BearerToken) != 0 { if len(x.BearerToken) != 0 {
mm.AppendBytes(6, x.BearerToken) mm.AppendBytes(6, x.BearerToken)
} }
@ -2457,8 +2451,8 @@ func (x *MoveRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Meta") return fmt.Errorf("cannot unmarshal field %s", "Meta")
} }
x.Meta = append(x.Meta, new(KeyValue)) x.Meta = append(x.Meta, KeyValue{})
ff := x.Meta[len(x.Meta)-1] ff := &x.Meta[len(x.Meta)-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)
} }
@ -2508,13 +2502,13 @@ func (x *MoveRequest_Body) GetNodeId() uint64 {
func (x *MoveRequest_Body) SetNodeId(v uint64) { func (x *MoveRequest_Body) SetNodeId(v uint64) {
x.NodeId = v x.NodeId = v
} }
func (x *MoveRequest_Body) GetMeta() []*KeyValue { func (x *MoveRequest_Body) GetMeta() []KeyValue {
if x != nil { if x != nil {
return x.Meta return x.Meta
} }
return nil return nil
} }
func (x *MoveRequest_Body) SetMeta(v []*KeyValue) { func (x *MoveRequest_Body) SetMeta(v []KeyValue) {
x.Meta = v x.Meta = v
} }
func (x *MoveRequest_Body) GetBearerToken() []byte { func (x *MoveRequest_Body) GetBearerToken() []byte {
@ -2630,11 +2624,11 @@ func (x *MoveRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "meta": case "meta":
{ {
var f *KeyValue var f KeyValue
var list []*KeyValue var list []KeyValue
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(KeyValue) f = KeyValue{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -3687,7 +3681,7 @@ func (x *GetNodeByPathRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
type GetNodeByPathResponse_Info struct { type GetNodeByPathResponse_Info struct {
NodeId uint64 `json:"nodeId"` NodeId uint64 `json:"nodeId"`
Timestamp uint64 `json:"timestamp"` Timestamp uint64 `json:"timestamp"`
Meta []*KeyValue `json:"meta"` Meta []KeyValue `json:"meta"`
ParentId uint64 `json:"parentId"` ParentId uint64 `json:"parentId"`
} }
@ -3708,7 +3702,7 @@ func (x *GetNodeByPathResponse_Info) StableSize() (size int) {
size += proto.UInt64Size(1, x.NodeId) size += proto.UInt64Size(1, x.NodeId)
size += proto.UInt64Size(2, x.Timestamp) size += proto.UInt64Size(2, x.Timestamp)
for i := range x.Meta { for i := range x.Meta {
size += proto.NestedStructureSize(3, x.Meta[i]) size += proto.NestedStructureSizeUnchecked(3, &x.Meta[i])
} }
size += proto.UInt64Size(4, x.ParentId) size += proto.UInt64Size(4, x.ParentId)
return size return size
@ -3734,10 +3728,8 @@ func (x *GetNodeByPathResponse_Info) EmitProtobuf(mm *easyproto.MessageMarshaler
mm.AppendUint64(2, x.Timestamp) mm.AppendUint64(2, x.Timestamp)
} }
for i := range x.Meta { for i := range x.Meta {
if x.Meta[i] != nil {
x.Meta[i].EmitProtobuf(mm.AppendMessage(3)) x.Meta[i].EmitProtobuf(mm.AppendMessage(3))
} }
}
if x.ParentId != 0 { if x.ParentId != 0 {
mm.AppendUint64(4, x.ParentId) mm.AppendUint64(4, x.ParentId)
} }
@ -3769,8 +3761,8 @@ func (x *GetNodeByPathResponse_Info) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Meta") return fmt.Errorf("cannot unmarshal field %s", "Meta")
} }
x.Meta = append(x.Meta, new(KeyValue)) x.Meta = append(x.Meta, KeyValue{})
ff := x.Meta[len(x.Meta)-1] ff := &x.Meta[len(x.Meta)-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)
} }
@ -3802,13 +3794,13 @@ func (x *GetNodeByPathResponse_Info) GetTimestamp() uint64 {
func (x *GetNodeByPathResponse_Info) SetTimestamp(v uint64) { func (x *GetNodeByPathResponse_Info) SetTimestamp(v uint64) {
x.Timestamp = v x.Timestamp = v
} }
func (x *GetNodeByPathResponse_Info) GetMeta() []*KeyValue { func (x *GetNodeByPathResponse_Info) GetMeta() []KeyValue {
if x != nil { if x != nil {
return x.Meta return x.Meta
} }
return nil return nil
} }
func (x *GetNodeByPathResponse_Info) SetMeta(v []*KeyValue) { func (x *GetNodeByPathResponse_Info) SetMeta(v []KeyValue) {
x.Meta = v x.Meta = v
} }
func (x *GetNodeByPathResponse_Info) GetParentId() uint64 { func (x *GetNodeByPathResponse_Info) GetParentId() uint64 {
@ -3902,11 +3894,11 @@ func (x *GetNodeByPathResponse_Info) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "meta": case "meta":
{ {
var f *KeyValue var f KeyValue
var list []*KeyValue var list []KeyValue
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(KeyValue) f = KeyValue{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -3930,7 +3922,7 @@ func (x *GetNodeByPathResponse_Info) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
type GetNodeByPathResponse_Body struct { type GetNodeByPathResponse_Body struct {
Nodes []*GetNodeByPathResponse_Info `json:"nodes"` Nodes []GetNodeByPathResponse_Info `json:"nodes"`
} }
var ( var (
@ -3948,7 +3940,7 @@ func (x *GetNodeByPathResponse_Body) StableSize() (size int) {
return 0 return 0
} }
for i := range x.Nodes { for i := range x.Nodes {
size += proto.NestedStructureSize(1, x.Nodes[i]) size += proto.NestedStructureSizeUnchecked(1, &x.Nodes[i])
} }
return size return size
} }
@ -3967,11 +3959,9 @@ func (x *GetNodeByPathResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler
return return
} }
for i := range x.Nodes { for i := range x.Nodes {
if x.Nodes[i] != nil {
x.Nodes[i].EmitProtobuf(mm.AppendMessage(1)) x.Nodes[i].EmitProtobuf(mm.AppendMessage(1))
} }
} }
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *GetNodeByPathResponse_Body) UnmarshalProtobuf(src []byte) (err error) { func (x *GetNodeByPathResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
@ -3987,8 +3977,8 @@ func (x *GetNodeByPathResponse_Body) 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(GetNodeByPathResponse_Info)) x.Nodes = append(x.Nodes, GetNodeByPathResponse_Info{})
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)
} }
@ -3996,13 +3986,13 @@ func (x *GetNodeByPathResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
} }
return nil return nil
} }
func (x *GetNodeByPathResponse_Body) GetNodes() []*GetNodeByPathResponse_Info { func (x *GetNodeByPathResponse_Body) GetNodes() []GetNodeByPathResponse_Info {
if x != nil { if x != nil {
return x.Nodes return x.Nodes
} }
return nil return nil
} }
func (x *GetNodeByPathResponse_Body) SetNodes(v []*GetNodeByPathResponse_Info) { func (x *GetNodeByPathResponse_Body) SetNodes(v []GetNodeByPathResponse_Info) {
x.Nodes = v x.Nodes = v
} }
@ -4060,11 +4050,11 @@ func (x *GetNodeByPathResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch key { switch key {
case "nodes": case "nodes":
{ {
var f *GetNodeByPathResponse_Info var f GetNodeByPathResponse_Info
var list []*GetNodeByPathResponse_Info var list []GetNodeByPathResponse_Info
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(GetNodeByPathResponse_Info) f = GetNodeByPathResponse_Info{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
@ -4938,7 +4928,7 @@ type GetSubTreeResponse_Body struct {
NodeId []uint64 `json:"nodeId"` NodeId []uint64 `json:"nodeId"`
ParentId []uint64 `json:"parentId"` ParentId []uint64 `json:"parentId"`
Timestamp []uint64 `json:"timestamp"` Timestamp []uint64 `json:"timestamp"`
Meta []*KeyValue `json:"meta"` Meta []KeyValue `json:"meta"`
} }
var ( var (
@ -4965,7 +4955,7 @@ func (x *GetSubTreeResponse_Body) StableSize() (size int) {
size += protowire.SizeGroup(protowire.Number(3), protowire.SizeVarint(x.Timestamp[i])) size += protowire.SizeGroup(protowire.Number(3), protowire.SizeVarint(x.Timestamp[i]))
} }
for i := range x.Meta { for i := range x.Meta {
size += proto.NestedStructureSize(4, x.Meta[i]) size += proto.NestedStructureSizeUnchecked(4, &x.Meta[i])
} }
return size return size
} }
@ -4993,11 +4983,9 @@ func (x *GetSubTreeResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
mm.AppendUint64(3, x.Timestamp[j]) mm.AppendUint64(3, x.Timestamp[j])
} }
for i := range x.Meta { for i := range x.Meta {
if x.Meta[i] != nil {
x.Meta[i].EmitProtobuf(mm.AppendMessage(4)) x.Meta[i].EmitProtobuf(mm.AppendMessage(4))
} }
} }
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *GetSubTreeResponse_Body) UnmarshalProtobuf(src []byte) (err error) { func (x *GetSubTreeResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
@ -5031,8 +5019,8 @@ func (x *GetSubTreeResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
if !ok { if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Meta") return fmt.Errorf("cannot unmarshal field %s", "Meta")
} }
x.Meta = append(x.Meta, new(KeyValue)) x.Meta = append(x.Meta, KeyValue{})
ff := x.Meta[len(x.Meta)-1] ff := &x.Meta[len(x.Meta)-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)
} }
@ -5067,13 +5055,13 @@ func (x *GetSubTreeResponse_Body) GetTimestamp() []uint64 {
func (x *GetSubTreeResponse_Body) SetTimestamp(v []uint64) { func (x *GetSubTreeResponse_Body) SetTimestamp(v []uint64) {
x.Timestamp = v x.Timestamp = v
} }
func (x *GetSubTreeResponse_Body) GetMeta() []*KeyValue { func (x *GetSubTreeResponse_Body) GetMeta() []KeyValue {
if x != nil { if x != nil {
return x.Meta return x.Meta
} }
return nil return nil
} }
func (x *GetSubTreeResponse_Body) SetMeta(v []*KeyValue) { func (x *GetSubTreeResponse_Body) SetMeta(v []KeyValue) {
x.Meta = v x.Meta = v
} }
@ -5206,11 +5194,11 @@ func (x *GetSubTreeResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
} }
case "meta": case "meta":
{ {
var f *KeyValue var f KeyValue
var list []*KeyValue var list []KeyValue
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
f = new(KeyValue) f = KeyValue{}
f.UnmarshalEasyJSON(in) f.UnmarshalEasyJSON(in)
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()

View file

@ -123,7 +123,7 @@ func TestMessageSign(t *testing.T) {
ContainerId: rawCID1, ContainerId: rawCID1,
ParentId: 1, ParentId: 1,
NodeId: 2, NodeId: 2,
Meta: []*KeyValue{ Meta: []KeyValue{
{Key: "kkk", Value: []byte("vvv")}, {Key: "kkk", Value: []byte("vvv")},
}, },
}, },