forked from TrueCloudLab/frostfs-node
[#338] ir: Drop container notaryless code
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
03ab0ca30f
commit
fb708b3a2d
5 changed files with 66 additions and 121 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
cntClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/container"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||
containerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/container"
|
||||
containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||
|
@ -91,27 +90,7 @@ func (cp *Processor) checkPutContainer(ctx *putContainerContext) error {
|
|||
}
|
||||
|
||||
func (cp *Processor) approvePutContainer(ctx *putContainerContext) {
|
||||
e := ctx.e
|
||||
|
||||
var err error
|
||||
|
||||
prm := cntClient.PutPrm{}
|
||||
|
||||
prm.SetContainer(e.Container())
|
||||
prm.SetKey(e.PublicKey())
|
||||
prm.SetSignature(e.Signature())
|
||||
prm.SetToken(e.SessionToken())
|
||||
prm.SetName(ctx.d.Name())
|
||||
prm.SetZone(ctx.d.Zone())
|
||||
|
||||
if nr := e.NotaryRequest(); nr != nil {
|
||||
// put event was received via Notary service
|
||||
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
|
||||
} else {
|
||||
// put event was received via notification service
|
||||
err = cp.cnrClient.Put(prm)
|
||||
}
|
||||
if err != nil {
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(ctx.e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(logs.ContainerCouldNotApprovePutContainer,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
@ -171,22 +150,7 @@ func (cp *Processor) checkDeleteContainer(e containerEvent.Delete) error {
|
|||
}
|
||||
|
||||
func (cp *Processor) approveDeleteContainer(e containerEvent.Delete) {
|
||||
var err error
|
||||
|
||||
prm := cntClient.DeletePrm{}
|
||||
|
||||
prm.SetCID(e.ContainerID())
|
||||
prm.SetSignature(e.Signature())
|
||||
prm.SetToken(e.SessionToken())
|
||||
|
||||
if nr := e.NotaryRequest(); nr != nil {
|
||||
// delete event was received via Notary service
|
||||
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
|
||||
} else {
|
||||
// delete event was received via notification service
|
||||
err = cp.cnrClient.Delete(prm)
|
||||
}
|
||||
if err != nil {
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(logs.ContainerCouldNotApproveDeleteContainer,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue