forked from TrueCloudLab/frostfs-node
[#374] Add inner-ring event metrics
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
8dcd06c587
commit
ebcc8afbee
27 changed files with 287 additions and 113 deletions
|
@ -31,10 +31,10 @@ type putContainerContext struct {
|
|||
|
||||
// Process a new container from the user by checking the container sanity
|
||||
// and sending approve tx back to the morph.
|
||||
func (cp *Processor) processContainerPut(put putEvent) {
|
||||
func (cp *Processor) processContainerPut(put putEvent) bool {
|
||||
if !cp.alphabetState.IsAlphabet() {
|
||||
cp.log.Info(logs.ContainerNonAlphabetModeIgnoreContainerPut)
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
ctx := &putContainerContext{
|
||||
|
@ -47,10 +47,17 @@ func (cp *Processor) processContainerPut(put putEvent) {
|
|||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
cp.approvePutContainer(ctx)
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(ctx.e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(logs.ContainerCouldNotApprovePutContainer,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (cp *Processor) checkPutContainer(ctx *putContainerContext) error {
|
||||
|
@ -89,20 +96,12 @@ func (cp *Processor) checkPutContainer(ctx *putContainerContext) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (cp *Processor) approvePutContainer(ctx *putContainerContext) {
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(ctx.e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(logs.ContainerCouldNotApprovePutContainer,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Process delete container operation from the user by checking container sanity
|
||||
// and sending approve tx back to morph.
|
||||
func (cp *Processor) processContainerDelete(e containerEvent.Delete) {
|
||||
func (cp *Processor) processContainerDelete(e containerEvent.Delete) bool {
|
||||
if !cp.alphabetState.IsAlphabet() {
|
||||
cp.log.Info(logs.ContainerNonAlphabetModeIgnoreContainerDelete)
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
err := cp.checkDeleteContainer(e)
|
||||
|
@ -111,10 +110,18 @@ func (cp *Processor) processContainerDelete(e containerEvent.Delete) {
|
|||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
cp.approveDeleteContainer(e)
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(logs.ContainerCouldNotApproveDeleteContainer,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (cp *Processor) checkDeleteContainer(e containerEvent.Delete) error {
|
||||
|
@ -149,14 +156,6 @@ func (cp *Processor) checkDeleteContainer(e containerEvent.Delete) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (cp *Processor) approveDeleteContainer(e containerEvent.Delete) {
|
||||
if err := cp.morphClient.NotarySignAndInvokeTX(e.NotaryRequest().MainTransaction); err != nil {
|
||||
cp.log.Error(logs.ContainerCouldNotApproveDeleteContainer,
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func checkNNS(ctx *putContainerContext, cnr containerSDK.Container) error {
|
||||
// fetch domain info
|
||||
ctx.d = containerSDK.ReadDomain(cnr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue