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 28 additions and 30 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))
|
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
|
||||||
})
|
})
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
2
go.mod
|
@ -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
|
||||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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{
|
||||||
|
|
|
@ -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,
|
||||||
})
|
})
|
||||||
|
|
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
|
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,
|
||||||
}
|
}
|
||||||
|
|
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,
|
ContainerId: rawCID1,
|
||||||
ParentId: 1,
|
ParentId: 1,
|
||||||
NodeId: 2,
|
NodeId: 2,
|
||||||
Meta: []*KeyValue{
|
Meta: []KeyValue{
|
||||||
{Key: "kkk", Value: []byte("vvv")},
|
{Key: "kkk", Value: []byte("vvv")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue