forked from TrueCloudLab/frostfs-node
[#1343] go.mod: Update api-go
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
882c068410
commit
98fe24cdb7
13 changed files with 30 additions and 32 deletions
|
@ -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))
|
||||
for _, i := range ii {
|
||||
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
|
||||
}
|
||||
|
||||
func prettyPrintShards(cmd *cobra.Command, ii []*control.ShardInfo) {
|
||||
func prettyPrintShards(cmd *cobra.Command, ii []control.ShardInfo) {
|
||||
for _, i := range ii {
|
||||
pathPrinter := func(name, path string) string {
|
||||
if path == "" {
|
||||
|
@ -121,7 +121,7 @@ func shardModeToString(m control.ShardMode) string {
|
|||
return "unknown"
|
||||
}
|
||||
|
||||
func sortShardsByID(ii []*control.ShardInfo) {
|
||||
func sortShardsByID(ii []control.ShardInfo) {
|
||||
sort.Slice(ii, func(i, j int) bool {
|
||||
return bytes.Compare(ii[i].GetShard_ID(), ii[j].GetShard_ID()) < 0
|
||||
})
|
||||
|
|
|
@ -77,13 +77,13 @@ func add(cmd *cobra.Command, _ []string) {
|
|||
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)
|
||||
if len(raws) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
pairs := make([]*tree.KeyValue, 0, len(raws))
|
||||
pairs := make([]tree.KeyValue, 0, len(raws))
|
||||
for i := range raws {
|
||||
k, v, found := strings.Cut(raws[i], "=")
|
||||
if !found {
|
||||
|
@ -94,7 +94,7 @@ func parseMeta(cmd *cobra.Command) ([]*tree.KeyValue, error) {
|
|||
pair.Key = k
|
||||
pair.Value = []byte(v)
|
||||
|
||||
pairs = append(pairs, &pair)
|
||||
pairs = append(pairs, pair)
|
||||
}
|
||||
|
||||
return pairs, nil
|
||||
|
|
|
@ -75,7 +75,7 @@ func move(cmd *cobra.Command, _ []string) {
|
|||
resp, err := cli.GetSubTree(ctx, subTreeReq)
|
||||
commonCmd.ExitOnErr(cmd, "rpc call: %w", err)
|
||||
|
||||
var meta []*tree.KeyValue
|
||||
var meta []tree.KeyValue
|
||||
subtreeResp, err := resp.Recv()
|
||||
for ; err == nil; subtreeResp, err = resp.Recv() {
|
||||
meta = subtreeResp.GetBody().GetMeta()
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.22
|
|||
|
||||
require (
|
||||
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-crypto v0.6.0
|
||||
git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,7 +1,7 @@
|
|||
code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8=
|
||||
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.20240827104600-eba18f6e67ac/go.mod h1:BDnEpkKMykCS8u1nLzR6SgNzCv6885RWlo5TnravQuI=
|
||||
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.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/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
||||
|
|
|
@ -25,7 +25,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) (
|
|||
|
||||
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 {
|
||||
si := new(control.ShardInfo)
|
||||
|
@ -54,7 +54,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) (
|
|||
si.SetMode(m)
|
||||
si.SetErrorCount(sh.ErrorCount)
|
||||
|
||||
shardInfos = append(shardInfos, si)
|
||||
shardInfos = append(shardInfos, *si)
|
||||
}
|
||||
|
||||
body.SetShards(shardInfos)
|
||||
|
@ -67,10 +67,10 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) (
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
func blobstorInfoToProto(info blobstor.Info) []*control.BlobstorInfo {
|
||||
res := make([]*control.BlobstorInfo, len(info.SubStorages))
|
||||
func blobstorInfoToProto(info blobstor.Info) []control.BlobstorInfo {
|
||||
res := make([]control.BlobstorInfo, len(info.SubStorages))
|
||||
for i := range info.SubStorages {
|
||||
res[i] = &control.BlobstorInfo{
|
||||
res[i] = control.BlobstorInfo{
|
||||
Path: info.SubStorages[i].Path,
|
||||
Type: info.SubStorages[i].Type,
|
||||
}
|
||||
|
|
|
@ -220,13 +220,13 @@ func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListT
|
|||
if err != nil {
|
||||
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 {
|
||||
target, err := controlTarget(&apeTargets[i])
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
targets = append(targets, &target)
|
||||
targets = append(targets, target)
|
||||
}
|
||||
|
||||
resp := &control.ListTargetsLocalOverridesResponse{
|
||||
|
|
|
@ -32,12 +32,12 @@ func (s *Server) SealWriteCache(ctx context.Context, req *control.SealWriteCache
|
|||
resp := &control.SealWriteCacheResponse{Body: &control.SealWriteCacheResponse_Body{}}
|
||||
for _, r := range res.ShardResults {
|
||||
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,
|
||||
Success: true,
|
||||
})
|
||||
} 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,
|
||||
Error: r.ErrorMsg,
|
||||
})
|
||||
|
|
BIN
pkg/services/control/service_frostfs.pb.go
generated
BIN
pkg/services/control/service_frostfs.pb.go
generated
Binary file not shown.
BIN
pkg/services/control/types_frostfs.pb.go
generated
BIN
pkg/services/control/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -360,7 +360,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := make([]*GetNodeByPathResponse_Info, 0, len(nodes))
|
||||
info := make([]GetNodeByPathResponse_Info, 0, len(nodes))
|
||||
for _, node := range nodes {
|
||||
m, parent, err := s.forest.TreeGetMeta(ctx, cid, b.GetTreeId(), node)
|
||||
if err != nil {
|
||||
|
@ -374,11 +374,11 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
|
|||
if b.GetAllAttributes() {
|
||||
x.Meta = metaToProto(m.Items)
|
||||
} else {
|
||||
var metaValue []*KeyValue
|
||||
var metaValue []KeyValue
|
||||
for _, kv := range m.Items {
|
||||
for _, attr := range b.GetAttributes() {
|
||||
if kv.Key == attr {
|
||||
metaValue = append(metaValue, &KeyValue{
|
||||
metaValue = append(metaValue, KeyValue{
|
||||
Key: kv.Key,
|
||||
Value: kv.Value,
|
||||
})
|
||||
|
@ -388,7 +388,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
|
|||
}
|
||||
x.Meta = metaValue
|
||||
}
|
||||
info = append(info, &x)
|
||||
info = append(info, x)
|
||||
}
|
||||
|
||||
return &GetNodeByPathResponse{
|
||||
|
@ -782,21 +782,19 @@ func (s *Service) TreeList(ctx context.Context, req *TreeListRequest) (*TreeList
|
|||
}, nil
|
||||
}
|
||||
|
||||
func protoToMeta(arr []*KeyValue) []pilorama.KeyValue {
|
||||
func protoToMeta(arr []KeyValue) []pilorama.KeyValue {
|
||||
meta := make([]pilorama.KeyValue, len(arr))
|
||||
for i, kv := range arr {
|
||||
if kv != nil {
|
||||
meta[i].Key = kv.GetKey()
|
||||
meta[i].Value = kv.GetValue()
|
||||
}
|
||||
meta[i].Key = kv.GetKey()
|
||||
meta[i].Value = kv.GetValue()
|
||||
}
|
||||
return meta
|
||||
}
|
||||
|
||||
func metaToProto(arr []pilorama.KeyValue) []*KeyValue {
|
||||
meta := make([]*KeyValue, len(arr))
|
||||
func metaToProto(arr []pilorama.KeyValue) []KeyValue {
|
||||
meta := make([]KeyValue, len(arr))
|
||||
for i, kv := range arr {
|
||||
meta[i] = &KeyValue{
|
||||
meta[i] = KeyValue{
|
||||
Key: kv.Key,
|
||||
Value: kv.Value,
|
||||
}
|
||||
|
|
BIN
pkg/services/tree/service_frostfs.pb.go
generated
BIN
pkg/services/tree/service_frostfs.pb.go
generated
Binary file not shown.
|
@ -123,7 +123,7 @@ func TestMessageSign(t *testing.T) {
|
|||
ContainerId: rawCID1,
|
||||
ParentId: 1,
|
||||
NodeId: 2,
|
||||
Meta: []*KeyValue{
|
||||
Meta: []KeyValue{
|
||||
{Key: "kkk", Value: []byte("vvv")},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue