From a275a71a87a773893af1d002103279de963397c0 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 19 Apr 2022 21:01:49 +0300 Subject: [PATCH] [#1318] node: Use new tombstone handling Signed-off-by: Pavel Karpy --- cmd/neofs-node/config.go | 20 +++++++++++++++++++- cmd/neofs-node/object.go | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index f9fb214bd..6c2bb5ecb 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -35,6 +35,9 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/network/cache" "github.com/nspcc-dev/neofs-node/pkg/services/control" "github.com/nspcc-dev/neofs-node/pkg/services/object/acl/eacl" + getsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/get" + "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/tombstone" + tsourse "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/tombstone/source" trustcontroller "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/controller" truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage" "github.com/nspcc-dev/neofs-node/pkg/services/util/response" @@ -175,6 +178,8 @@ type cfgNodeInfo struct { } type cfgObject struct { + getSvc *getsvc.Service + cnrSource container.Source eaclSource eacl.Source @@ -346,8 +351,21 @@ func initLocalStorage(c *cfg) { ls := engine.New(engineOpts...) + // allocate memory for the service; + // service will be created later + c.cfgObject.getSvc = new(getsvc.Service) + + var tssPrm tsourse.TombstoneSourcePrm + tssPrm.SetGetService(c.cfgObject.getSvc) + tombstoneSrc := tsourse.NewSource(tssPrm) + + tombstoneSource := tombstone.NewChecker( + tombstone.WithLogger(c.log), + tombstone.WithTombstoneSource(tombstoneSrc), + ) + for _, opts := range c.cfgObject.cfgLocalStorage.shardOpts { - id, err := ls.AddShard(opts...) + id, err := ls.AddShard(append(opts, shard.WithTombstoneSource(tombstoneSource))...) fatalOnErr(err) c.log.Info("shard attached to engine", diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 2cdea53c8..f339d6578 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -318,6 +318,8 @@ func initObjectService(c *cfg) { getsvc.WithKeyStorage(keyStorage), ) + *c.cfgObject.getSvc = *sGet // need smth better + sGetV2 := getsvcV2.NewService( getsvcV2.WithInternalService(sGet), getsvcV2.WithKeyStorage(keyStorage),