forked from TrueCloudLab/frostfs-node
[#770] ir/container: Support notary Put
Implement `NotaryContractProcessor` by IR container processor. Add support for notary `put` container operation. Do not parse `put` non-notary notifications in notary enabled environment. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
9921358f09
commit
13f1273e82
3 changed files with 60 additions and 9 deletions
|
@ -86,7 +86,15 @@ func (cp *Processor) checkPutContainer(e *containerEvent.Put) error {
|
|||
}
|
||||
|
||||
func (cp *Processor) approvePutContainer(e *containerEvent.Put) {
|
||||
err := cp.cnrClient.Put(e.Container(), e.PublicKey(), e.Signature(), e.SessionToken())
|
||||
var err error
|
||||
|
||||
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(e.Container(), e.PublicKey(), e.Signature(), e.SessionToken())
|
||||
}
|
||||
if err != nil {
|
||||
cp.log.Error("could not approve put container",
|
||||
zap.String("error", err.Error()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue