[#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 <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-26 13:40:03 +03:00 committed by Leonard Lyubich
parent 9a0964efa4
commit a1e1350db0

View file

@ -2,6 +2,7 @@ package container
import ( import (
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" 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 // RemovalWitness groups the information required
@ -10,6 +11,8 @@ type RemovalWitness struct {
cid *cid.ID cid *cid.ID
sig []byte sig []byte
token *session.Token
} }
// ContainerID returns identifier of the container // ContainerID returns identifier of the container
@ -33,3 +36,15 @@ func (x RemovalWitness) Signature() []byte {
func (x *RemovalWitness) SetSignature(sig []byte) { func (x *RemovalWitness) SetSignature(sig []byte) {
x.sig = sig 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
}