[#195] Use exp epoch attribute instead of tick

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-03-17 17:03:06 +03:00 committed by Angira Kekteeva
parent cfcc8933e4
commit 9d19acadcd
4 changed files with 15 additions and 35 deletions

View file

@ -21,7 +21,6 @@ import (
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/eacl"
"github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object/address"
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/owner"
"github.com/nspcc-dev/neofs-sdk-go/pool"
@ -290,9 +289,7 @@ func (n *layer) Initialize(ctx context.Context, c Notificator) error {
return fmt.Errorf("already initialized")
}
if err := c.Subscribe(ctx, LockTopic, MsgHandlerFunc(n.handleLockTick)); err != nil {
return fmt.Errorf("couldn't initialize layer: %w", err)
}
// todo add notification handlers (e.g. for lifecycles)
c.Listen(ctx)
@ -304,19 +301,6 @@ func (n *layer) IsNotificationEnabled() bool {
return n.ncontroller != nil
}
func (n *layer) handleLockTick(ctx context.Context, msg *nats.Msg) error {
addr := address.NewAddress()
if err := addr.Parse(string(msg.Data)); err != nil {
return fmt.Errorf("invalid msg, address expected: %w", err)
}
n.log.Debug("handling lock tick", zap.String("address", string(msg.Data)))
// todo clear cache
// and make sure having right access
return n.objectDelete(ctx, addr.ContainerID(), addr.ObjectID())
}
// IsAuthenticatedRequest check if access box exists in current request.
func IsAuthenticatedRequest(ctx context.Context) bool {
_, ok := ctx.Value(api.BoxData).(*accessbox.Box)