From a1e1350db05c9008208dd8c3430b1188fa297219 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 26 May 2021 13:40:03 +0300 Subject: [PATCH] [#525] core/container: Extend removal witness with session token NeoFS containers can be removed within a trusted session. There is a need to take this into account during removal inspection. Define `SessionToken` / `SetSessionToken` methods on `RemovalWitness` struct in order to embed `session.Token` to it. Signed-off-by: Leonard Lyubich --- pkg/core/container/delete.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/core/container/delete.go b/pkg/core/container/delete.go index dc13b1db..6c5525f6 100644 --- a/pkg/core/container/delete.go +++ b/pkg/core/container/delete.go @@ -2,6 +2,7 @@ package container import ( cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + "github.com/nspcc-dev/neofs-api-go/pkg/session" ) // RemovalWitness groups the information required @@ -10,6 +11,8 @@ type RemovalWitness struct { cid *cid.ID sig []byte + + token *session.Token } // ContainerID returns identifier of the container @@ -33,3 +36,15 @@ func (x RemovalWitness) Signature() []byte { func (x *RemovalWitness) SetSignature(sig []byte) { x.sig = sig } + +// SessionToken returns token of the session within +// which container was removed. +func (x RemovalWitness) SessionToken() *session.Token { + return x.token +} + +// SetSessionToken sets token of the session within +// which container was removed. +func (x *RemovalWitness) SetSessionToken(tok *session.Token) { + x.token = tok +}