diff --git a/client/object_put.go b/client/object_put.go index 8773f284..45bd9a8f 100644 --- a/client/object_put.go +++ b/client/object_put.go @@ -40,7 +40,9 @@ type PrmObjectPutInit struct { copyNum uint32 } -// SetCopiesNumber sets number of object copies that is enough to consider put successful. +// SetCopiesNumber sets the minimal number of copies (out of the number specified by container placement policy) for +// the object PUT operation to succeed. This means that object operation will return with successful status even before +// container placement policy is completely satisfied. func (x *PrmObjectPutInit) SetCopiesNumber(copiesNumber uint32) { x.copyNum = copiesNumber } diff --git a/object/slicer/options.go b/object/slicer/options.go index 9d25d005..9f4844cb 100644 --- a/object/slicer/options.go +++ b/object/slicer/options.go @@ -13,6 +13,8 @@ type Options struct { withHomoChecksum bool + copiesNumber uint32 + sessionToken *session.Object bearerToken *bearer.Token } @@ -45,6 +47,13 @@ func (x *Options) SetBearerToken(bearerToken *bearer.Token) { x.bearerToken = bearerToken } +// SetCopiesNumber sets the minimal number of copies (out of the number specified by container placement policy) for +// the object PUT operation to succeed. This means that object operation will return with successful status even before +// container placement policy is completely satisfied. +func (x *Options) SetCopiesNumber(copiesNumber uint32) { + x.copiesNumber = copiesNumber +} + // ObjectPayloadLimit returns required max object size. func (x *Options) ObjectPayloadLimit() uint64 { return x.objectPayloadLimit @@ -69,3 +78,8 @@ func (x *Options) Session() *session.Object { func (x *Options) BearerToken() *bearer.Token { return x.bearerToken } + +// CopiesNumber returns the number of object copies. +func (x *Options) CopiesNumber() uint32 { + return x.copiesNumber +} diff --git a/object/slicer/slicer.go b/object/slicer/slicer.go index cd07de2d..76807218 100644 --- a/object/slicer/slicer.go +++ b/object/slicer/slicer.go @@ -218,6 +218,7 @@ func initPayloadStream(ctx context.Context, ow ObjectWriter, header object.Objec } var prm client.PrmObjectPutInit + prm.SetCopiesNumber(opts.copiesNumber) if opts.sessionToken != nil { prm.WithinSession(*opts.sessionToken)