From 0beb7ccf5c164241fdaf71eebb646503c6c4620d Mon Sep 17 00:00:00 2001
From: Pavel Karpy
Date: Tue, 11 Apr 2023 21:01:00 +0300
Subject: [PATCH] [#284] node: Use `copy_number` on server side
Signed-off-by: Pavel Karpy
---
CHANGELOG.md | 2 ++
pkg/services/object/put/prm.go | 8 ++++++++
pkg/services/object/put/v2/util.go | 3 ++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4d6e7ca0..19449efdd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ Changelog for FrostFS Node
### Added
### Changed
### Fixed
+- Copy number was not used for `PUT` requests (#284)
+
### Removed
### Updated
### Updating from v0.36.0
diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go
index aea5926f4..5c305df3b 100644
--- a/pkg/services/object/put/prm.go
+++ b/pkg/services/object/put/prm.go
@@ -40,6 +40,14 @@ func (p *PutInitPrm) WithObject(v *object.Object) *PutInitPrm {
return p
}
+func (p *PutInitPrm) WithCopyNumber(v uint32) *PutInitPrm {
+ if p != nil {
+ p.traverseOpts = append(p.traverseOpts, placement.SuccessAfter(v))
+ }
+
+ return p
+}
+
func (p *PutInitPrm) WithRelay(f func(client.NodeInfo, client.MultiAddressClient) error) *PutInitPrm {
if p != nil {
p.relay = f
diff --git a/pkg/services/object/put/v2/util.go b/pkg/services/object/put/v2/util.go
index 790f061f1..d0fa6f88d 100644
--- a/pkg/services/object/put/v2/util.go
+++ b/pkg/services/object/put/v2/util.go
@@ -24,7 +24,8 @@ func (s *streamer) toInitPrm(part *objectV2.PutObjectPartInit, req *objectV2.Put
object.NewFromV2(oV2),
).
WithRelay(s.relayRequest).
- WithCommonPrm(commonPrm), nil
+ WithCommonPrm(commonPrm).
+ WithCopyNumber(part.GetCopiesNumber()), nil
}
func toChunkPrm(req *objectV2.PutObjectPartChunk) *putsvc.PutChunkPrm {
--
2.45.2