[#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 <leonard@nspcc.ru>
This commit is contained in:
parent
b8d1144839
commit
b644589bb4
2 changed files with 19 additions and 0 deletions
|
@ -145,6 +145,8 @@ const (
|
||||||
cfgGCRemoverSleepInt = "remover_sleep_interval"
|
cfgGCRemoverSleepInt = "remover_sleep_interval"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const cfgTombstoneLifetime = "tombstone_lifetime"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
addressSize = 72 // 32 bytes oid, 32 bytes cid, 8 bytes protobuf encoding
|
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(cfgObjectRangeHashPoolSize, 10)
|
||||||
|
|
||||||
v.SetDefault(cfgCtrlSvcAuthorizedKeys, []string{})
|
v.SetDefault(cfgCtrlSvcAuthorizedKeys, []string{})
|
||||||
|
|
||||||
|
v.SetDefault(cfgTombstoneLifetime, 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cfg) LocalAddress() *network.Address {
|
func (c *cfg) LocalAddress() *network.Address {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
|
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"
|
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/local_object_storage/engine"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
"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) {
|
func initObjectService(c *cfg) {
|
||||||
ls := c.cfgObject.cfgLocalStorage.localStorage
|
ls := c.cfgObject.cfgLocalStorage.localStorage
|
||||||
keyStorage := util.NewKeyStorage(c.key, c.privateTokenStore)
|
keyStorage := util.NewKeyStorage(c.key, c.privateTokenStore)
|
||||||
|
@ -275,6 +286,10 @@ func initObjectService(c *cfg) {
|
||||||
deletesvc.WithHeadService(sGet),
|
deletesvc.WithHeadService(sGet),
|
||||||
deletesvc.WithSearchService(sSearch),
|
deletesvc.WithSearchService(sSearch),
|
||||||
deletesvc.WithPutService(sPut),
|
deletesvc.WithPutService(sPut),
|
||||||
|
deletesvc.WithNetworkInfo(&delNetInfo{
|
||||||
|
State: c.cfgNetmap.state,
|
||||||
|
tsLifetime: c.viper.GetUint64(cfgTombstoneLifetime),
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
sDeleteV2 := deletesvcV2.NewService(
|
sDeleteV2 := deletesvcV2.NewService(
|
||||||
|
|
Loading…
Reference in a new issue