[#44] pool: Add copies number vector when putting object

Signed-off-by: Artem Tataurov <a.tataurov@yadro.com>
This commit is contained in:
Artem Tataurov 2023-04-17 21:59:50 +03:00
parent db5b89496d
commit d0762d037d

View file

@ -615,7 +615,7 @@ func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID
} }
var cliPrm sdkClient.PrmObjectPutInit 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 { if prm.stoken != nil {
cliPrm.WithinSession(*prm.stoken) cliPrm.WithinSession(*prm.stoken)
} }
@ -1257,7 +1257,7 @@ type PrmObjectPut struct {
payload io.Reader payload io.Reader
copiesNumber uint32 copiesNumber []uint32
} }
// SetHeader specifies header of the object. // 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. // SetCopiesNumber sets number of object copies that is enough to consider put successful.
// Zero means using default behavior. // Zero means using default behavior.
func (x *PrmObjectPut) SetCopiesNumber(copiesNumber uint32) { 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 x.copiesNumber = copiesNumber
} }