2021-05-26 10:30:08 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
2022-12-23 17:35:35 +00:00
|
|
|
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
|
|
|
|
"github.com/TrueCloudLab/frostfs-sdk-go/session"
|
2021-05-26 10:30:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// RemovalWitness groups the information required
|
|
|
|
// to prove and verify the removal of a container.
|
|
|
|
type RemovalWitness struct {
|
2022-05-31 17:00:41 +00:00
|
|
|
cnr cid.ID
|
2021-05-26 10:30:08 +00:00
|
|
|
|
|
|
|
sig []byte
|
2021-05-26 10:40:03 +00:00
|
|
|
|
2022-05-18 15:20:08 +00:00
|
|
|
token *session.Container
|
2021-05-26 10:30:08 +00:00
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// ContainerID returns the identifier of the container
|
2021-05-26 10:30:08 +00:00
|
|
|
// to be removed.
|
2022-05-31 17:00:41 +00:00
|
|
|
func (x RemovalWitness) ContainerID() cid.ID {
|
|
|
|
return x.cnr
|
2021-05-26 10:30:08 +00:00
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// SetContainerID sets the identifier of the container
|
2021-05-26 10:30:08 +00:00
|
|
|
// to be removed.
|
2022-05-31 17:00:41 +00:00
|
|
|
func (x *RemovalWitness) SetContainerID(id cid.ID) {
|
|
|
|
x.cnr = id
|
2021-05-26 10:30:08 +00:00
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// Signature returns the signature of the container identifier.
|
2021-05-26 10:30:08 +00:00
|
|
|
func (x RemovalWitness) Signature() []byte {
|
|
|
|
return x.sig
|
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// SetSignature sets a signature of the container identifier.
|
2021-05-26 10:30:08 +00:00
|
|
|
func (x *RemovalWitness) SetSignature(sig []byte) {
|
|
|
|
x.sig = sig
|
|
|
|
}
|
2021-05-26 10:40:03 +00:00
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// SessionToken returns the token of the session within
|
|
|
|
// which the container was removed.
|
2022-05-18 15:20:08 +00:00
|
|
|
func (x RemovalWitness) SessionToken() *session.Container {
|
2021-05-26 10:40:03 +00:00
|
|
|
return x.token
|
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// SetSessionToken sets the token of the session within
|
|
|
|
// which the container was removed.
|
2022-05-18 15:20:08 +00:00
|
|
|
func (x *RemovalWitness) SetSessionToken(tok *session.Container) {
|
2021-05-26 10:40:03 +00:00
|
|
|
x.token = tok
|
|
|
|
}
|