From ab57fddb2b50459c2737ad33587905706d9ca251 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 3 Oct 2020 13:26:42 +0300 Subject: [PATCH] [#70] cmd/neofs-node: Add object GC to app Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index c5d06fa70..8e7f4fa69 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -31,6 +31,7 @@ import ( searchsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/search" searchsvcV2 "github.com/nspcc-dev/neofs-node/pkg/services/object/search/v2" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" + "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/gc" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/panjf2000/ants/v2" "go.uber.org/zap" @@ -187,6 +188,13 @@ func initObjectService(c *cfg) { nodeOwner.SetNeo3Wallet(neo3Wallet) + objGC := gc.New( + gc.WithLogger(c.log), + gc.WithRemover(ls), + ) + + c.workers = append(c.workers, objGC) + sPut := putsvc.NewService( putsvc.WithKeyStorage(keyStorage), putsvc.WithMaxSizeSource(&maxSzSrc{c.cfgObject.maxObjectSize}), @@ -195,7 +203,7 @@ func initObjectService(c *cfg) { putsvc.WithNetworkMapSource(c.cfgObject.netMapStorage), putsvc.WithLocalAddressSource(c), putsvc.WithFormatValidatorOpts( - objectCore.WithDeleteHandler(&deleteHandler{c.log}), + objectCore.WithDeleteHandler(objGC), ), )