From b644589bb451b03f7146e0cb571e51aff1b32bf6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 15:32:04 +0300 Subject: [PATCH] [#378] cmd/node: Configure tombstone lifetime Add `TOMBSTONE_LIFETIME` configuration value of the node which is measured in NeoFS epoch and is set to 5 by default. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 4 ++++ cmd/neofs-node/object.go | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 8468aff32..6bc050163 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -145,6 +145,8 @@ const ( cfgGCRemoverSleepInt = "remover_sleep_interval" ) +const cfgTombstoneLifetime = "tombstone_lifetime" + const ( addressSize = 72 // 32 bytes oid, 32 bytes cid, 8 bytes protobuf encoding ) @@ -442,6 +444,8 @@ func defaultConfiguration(v *viper.Viper) { v.SetDefault(cfgObjectRangeHashPoolSize, 10) v.SetDefault(cfgCtrlSvcAuthorizedKeys, []string{}) + + v.SetDefault(cfgTombstoneLifetime, 5) } func (c *cfg) LocalAddress() *network.Address { diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index c095275b1..003db70ff 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -8,6 +8,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" + "github.com/nspcc-dev/neofs-node/pkg/core/netmap" objectCore "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -118,6 +119,16 @@ func (r *localObjectInhumer) DeleteObjects(ts *objectSDK.Address, addr ...*objec } } +type delNetInfo struct { + netmap.State + + tsLifetime uint64 +} + +func (i *delNetInfo) TombstoneLifetime() (uint64, error) { + return i.tsLifetime, nil +} + func initObjectService(c *cfg) { ls := c.cfgObject.cfgLocalStorage.localStorage keyStorage := util.NewKeyStorage(c.key, c.privateTokenStore) @@ -275,6 +286,10 @@ func initObjectService(c *cfg) { deletesvc.WithHeadService(sGet), deletesvc.WithSearchService(sSearch), deletesvc.WithPutService(sPut), + deletesvc.WithNetworkInfo(&delNetInfo{ + State: c.cfgNetmap.state, + tsLifetime: c.viper.GetUint64(cfgTombstoneLifetime), + }), ) sDeleteV2 := deletesvcV2.NewService(