From 4738508ce231fab8b10e3151056474a087c6a382 Mon Sep 17 00:00:00 2001 From: aarifullin Date: Fri, 29 Mar 2024 15:31:37 +0300 Subject: [PATCH] [#1063] go.mod: Update SDK version * Update frostfs-sdk and frostfs-api-go versions. * Refactor depreacted method ReplicaNumberByIndex. Signed-off-by: Airat Arifullin --- cmd/frostfs-cli/modules/container/create.go | 4 ++-- cmd/frostfs-cli/modules/container/nodes.go | 2 +- cmd/frostfs-cli/modules/object/nodes.go | 2 +- go.mod | 4 ++-- go.sum | Bin 41962 -> 41962 bytes .../object_manager/placement/traverser.go | 2 +- pkg/services/policer/check.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/frostfs-cli/modules/container/create.go b/cmd/frostfs-cli/modules/container/create.go index 728332b35..6d0ed750e 100644 --- a/cmd/frostfs-cli/modules/container/create.go +++ b/cmd/frostfs-cli/modules/container/create.go @@ -58,12 +58,12 @@ It will be stored in sidechain when inner ring will accepts it.`, "use --force option to skip this check: %w", err) for i, nodes := range nodesByRep { - if placementPolicy.ReplicaNumberByIndex(i) > uint32(len(nodes)) { + if placementPolicy.ReplicaDescriptor(i).NumberOfObjects() > uint32(len(nodes)) { commonCmd.ExitOnErr(cmd, "", fmt.Errorf( "the number of nodes '%d' in selector is not enough for the number of replicas '%d', "+ "use --force option to skip this check", len(nodes), - placementPolicy.ReplicaNumberByIndex(i), + placementPolicy.ReplicaDescriptor(i).NumberOfObjects(), )) } } diff --git a/cmd/frostfs-cli/modules/container/nodes.go b/cmd/frostfs-cli/modules/container/nodes.go index d785fa23d..b8765061c 100644 --- a/cmd/frostfs-cli/modules/container/nodes.go +++ b/cmd/frostfs-cli/modules/container/nodes.go @@ -46,7 +46,7 @@ var containerNodesCmd = &cobra.Command{ commonCmd.ExitOnErr(cmd, "could not build container nodes for given container: %w", err) for i := range cnrNodes { - cmd.Printf("Descriptor #%d, REP %d:\n", i+1, policy.ReplicaNumberByIndex(i)) + cmd.Printf("Descriptor #%d, REP %d:\n", i+1, policy.ReplicaDescriptor(i).NumberOfObjects()) for j := range cnrNodes[i] { commonCmd.PrettyPrintNodeInfo(cmd, cnrNodes[i][j], j, "\t", short) } diff --git a/cmd/frostfs-cli/modules/object/nodes.go b/cmd/frostfs-cli/modules/object/nodes.go index 50c47e822..38b9dec82 100644 --- a/cmd/frostfs-cli/modules/object/nodes.go +++ b/cmd/frostfs-cli/modules/object/nodes.go @@ -190,7 +190,7 @@ func getRequiredPlacement(cmd *cobra.Command, objInfo *objectNodesInfo, placemen placement, err := placementBuilder.BuildPlacement(objInfo.containerID, &objInfo.objectID, placementPolicy) commonCmd.ExitOnErr(cmd, "failed to get required placement: %w", err) for repIdx, rep := range placement { - numOfReplicas := placementPolicy.ReplicaNumberByIndex(repIdx) + numOfReplicas := placementPolicy.ReplicaDescriptor(repIdx).NumberOfObjects() var nodeIdx uint32 for _, n := range rep { if !objInfo.isLockOrTombstone && nodeIdx == numOfReplicas { // lock and tombstone objects should be on all container nodes diff --git a/go.mod b/go.mod index 1d18bb9d3..3159b9c0a 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( code.gitea.io/sdk/gitea v0.17.1 - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240215124401-634e24aba715 + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240327095603-491a47e7fe24 git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.0 git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20231101111734-b3ad3335ff65 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240301150205-6fe4e2541d0b + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240329104804-ec0cb2169f92 git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240307151106-2ec958cbfdfd git.frostfs.info/TrueCloudLab/tzhash v1.8.0 diff --git a/go.sum b/go.sum index d90bf0f6a5ed881e6779ffbbcb54401101efd301..e4bd28600d1f11e87b913a8409a3383830e4f25f 100644 GIT binary patch delta 333 zcmZwBJ5s_x007W2Bek`irOF_i-379a4PljpB!oadE?s^QG!Te`k(@#&y@gkxwx+W1 z5*Ac?1EsUz0&m`S!)-U*^Vcx7MU2u4|n?Vajfpgs^jEhnglyj7wI4^(}m6F*rv%cxkXHi z!>*5MPqanHY$J!7u&40JpLteD+|l~`;GLt8@Bj+{S3)279^~s}MBq-01}m)w17Rh* z`kWcD8rv*L+upeK@F>%}EJn?a+p%KSvx>#xm9iK5H=KaJvY6c999jC4I_PGRl$Cue cuXa|FAJNOFB&P)!z zgaeblfv`ES{==7lyWzGQ?&aGOpbP~`0#Z+(47ARyX3+_tK5WNnys$cH>_4Cv_jPW$T%5t>8bi) zHysRnQ!0zlS#`(7qZ*U0>+H;n%H~eiKSv*&0U(rt0OYzt@NQFz>% diff --git a/pkg/services/object_manager/placement/traverser.go b/pkg/services/object_manager/placement/traverser.go index 53da186e8..a699b4454 100644 --- a/pkg/services/object_manager/placement/traverser.go +++ b/pkg/services/object_manager/placement/traverser.go @@ -137,7 +137,7 @@ func defaultCopiesVector(policy netmap.PlacementPolicy) []int { copyVector := make([]int, 0, replNum) for i := 0; i < replNum; i++ { - copyVector = append(copyVector, int(policy.ReplicaNumberByIndex(i))) + copyVector = append(copyVector, int(policy.ReplicaDescriptor(i).NumberOfObjects())) } return copyVector diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index bb6313d07..d2297fed7 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -63,7 +63,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add default: } - p.processNodes(ctx, c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes) + p.processNodes(ctx, c, addrWithType, nn[i], policy.ReplicaDescriptor(i).NumberOfObjects(), checkedNodes) } if !c.needLocalCopy && c.removeLocalCopy {