[#7] Add container delete notification handler

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-09-02 19:04:29 +03:00
parent 480b3fd1a9
commit 5e5e431534
5 changed files with 80 additions and 13 deletions

View file

@ -24,3 +24,21 @@ func (cp *Processor) processContainerPut(put *containerEvent.Put) {
cp.log.Error("can't invoke new container", zap.Error(err))
}
}
// Process delete container operation from the user by checking container sanity
// and sending approve tx back to morph.
func (cp *Processor) processContainerDelete(delete *containerEvent.Delete) {
if !cp.activeState.IsActive() {
cp.log.Info("passive mode, ignore container put")
return
}
err := invoke.RemoveContainer(cp.morphClient, cp.containerContract,
&invoke.RemoveContainerParams{
ContainerID: delete.ContainerID(),
Signature: delete.Signature(),
})
if err != nil {
cp.log.Error("can't invoke delete container", zap.Error(err))
}
}