frostfs-node/pkg/core/container/delete.go
Leonard Lyubich a1e1350db0 [#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>
2021-05-27 12:03:49 +03:00

50 lines
1.1 KiB
Go

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
// to prove and verify the removal of a container.
type RemovalWitness struct {
cid *cid.ID
sig []byte
token *session.Token
}
// ContainerID returns identifier of the container
// to be removed.
func (x RemovalWitness) ContainerID() *cid.ID {
return x.cid
}
// SetContainerID sets identifier of the container
// to be removed.
func (x *RemovalWitness) SetContainerID(id *cid.ID) {
x.cid = id
}
// Signature returns signature of the container identifier.
func (x RemovalWitness) Signature() []byte {
return x.sig
}
// SetSignature sets signature of the container identifier.
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
}