From 113271b205c772eaa032505eff2b2639ced41eb1 Mon Sep 17 00:00:00 2001
From: Pavel Karpy
Date: Fri, 7 Apr 2023 18:40:54 +0300
Subject: [PATCH] [#46] client: Allow set `copy_number` for every placement
vector
Signed-off-by: Pavel Karpy
---
client/object_put.go | 11 +++++++++--
pool/pool.go | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/client/object_put.go b/client/object_put.go
index f25e44b..5995683 100644
--- a/client/object_put.go
+++ b/client/object_put.go
@@ -22,14 +22,21 @@ import (
// PrmObjectPutInit groups parameters of ObjectPutInit operation.
type PrmObjectPutInit struct {
- copyNum uint32
+ copyNum []uint32
key *ecdsa.PrivateKey
meta v2session.RequestMetaHeader
}
// SetCopiesNumber sets number of object copies that is enough to consider put successful.
func (x *PrmObjectPutInit) SetCopiesNumber(copiesNumber uint32) {
- x.copyNum = copiesNumber
+ x.copyNum = []uint32{copiesNumber}
+}
+
+// SetCopiesNumberByVectors sets ordered list of minimal required object copies numbers
+// per placement vector. List's length MUST equal container's placement vector number,
+// otherwise request will fail.
+func (x *PrmObjectPutInit) SetCopiesNumberByVectors(copiesNumbers []uint32) {
+ x.copyNum = copiesNumbers
}
// ResObjectPut groups the final result values of ObjectPutInit operation.
diff --git a/pool/pool.go b/pool/pool.go
index 772afc1..2776bd1 100644
--- a/pool/pool.go
+++ b/pool/pool.go
@@ -617,7 +617,7 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID
}
var cliPrm sdkClient.PrmObjectPutInit
- cliPrm.SetCopiesNumber(prm.copiesNumber)
+ cliPrm.SetCopiesNumber(prm.copiesNumber) // TODO(@ironbee): adopt multiple copy number https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/issues/44
if prm.stoken != nil {
cliPrm.WithinSession(*prm.stoken)
}