From d0762d037d2c5841aa069a708efcc5463c059539 Mon Sep 17 00:00:00 2001 From: Artem Tataurov Date: Mon, 17 Apr 2023 21:59:50 +0300 Subject: [PATCH] [#44] pool: Add copies number vector when putting object Signed-off-by: Artem Tataurov --- pool/pool.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 28715ac..f7abf4c 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -615,7 +615,7 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID } var cliPrm sdkClient.PrmObjectPutInit - cliPrm.SetCopiesNumber(prm.copiesNumber) // TODO(@ironbee): adopt multiple copy number https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/issues/44 + cliPrm.SetCopiesNumberByVectors(prm.copiesNumber) if prm.stoken != nil { cliPrm.WithinSession(*prm.stoken) } @@ -1257,7 +1257,7 @@ type PrmObjectPut struct { payload io.Reader - copiesNumber uint32 + copiesNumber []uint32 } // SetHeader specifies header of the object. @@ -1273,6 +1273,12 @@ func (x *PrmObjectPut) SetPayload(payload io.Reader) { // SetCopiesNumber sets number of object copies that is enough to consider put successful. // Zero means using default behavior. func (x *PrmObjectPut) SetCopiesNumber(copiesNumber uint32) { + x.copiesNumber = []uint32{copiesNumber} +} + +// SetCopiesNumberVector sets number of object copies that is enough to consider put successful, provided as array. +// Nil/empty vector means using default behavior. +func (x *PrmObjectPut) SetCopiesNumberVector(copiesNumber []uint32) { x.copiesNumber = copiesNumber }