From 23f00a3cd22a1f70f12c35205fce5d111bc5c6f4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 17:21:28 +0300 Subject: [PATCH] [#40] cmd/neofs-node: Re-implement max object size source Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 29a34c1b..94d9c21e 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -36,6 +36,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" "github.com/nspcc-dev/neofs-node/pkg/services/policer" "github.com/panjf2000/ants/v2" + "go.uber.org/zap" ) type objectSvc struct { @@ -60,12 +61,15 @@ type inMemBucket struct { items map[string][]byte } -type maxSzSrc struct { - v uint64 -} +func (c *cfg) MaxObjectSize() uint64 { + sz, err := c.cfgNetmap.wrapper.MaxObjectSize() + if err != nil { + c.log.Error("could not get max object size value", + zap.String("error", err.Error()), + ) + } -func (s *maxSzSrc) MaxObjectSize() uint64 { - return s.v + return sz } func newBucket() bucket.Bucket { @@ -225,7 +229,7 @@ func initObjectService(c *cfg) { sPut := putsvc.NewService( putsvc.WithKeyStorage(keyStorage), - putsvc.WithMaxSizeSource(&maxSzSrc{c.cfgObject.maxObjectSize}), + putsvc.WithMaxSizeSource(c), putsvc.WithLocalStorage(ls), putsvc.WithContainerSource(c.cfgObject.cnrStorage), putsvc.WithNetworkMapSource(c.cfgObject.netMapStorage),