[#378] object/delete: Set expiration epoch of the created tombstones

Make object delete service to use network information to calculate and set
expiration of the created tombstone.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-17 15:30:11 +03:00 committed by Alex Vanin
parent 717f2beb47
commit b8d1144839
3 changed files with 43 additions and 0 deletions

View file

@ -2,9 +2,11 @@ package deletesvc
import (
"context"
"strconv"
"github.com/nspcc-dev/neofs-api-go/pkg/container"
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
@ -236,6 +238,12 @@ func (exec *execCtx) initTombstoneObject() bool {
exec.tombstoneObj.SetType(objectSDK.TypeTombstone)
exec.tombstoneObj.SetPayload(payload)
a := objectSDK.NewAttribute()
a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.FormatUint(exec.tombstone.ExpirationEpoch(), 10))
exec.tombstoneObj.SetAttributes(a)
return true
}