All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 3m31s
DCO action / DCO (pull_request) Successful in 3m25s
Build / Build Components (1.21) (pull_request) Successful in 4m16s
Build / Build Components (1.22) (pull_request) Successful in 4m20s
Tests and linters / Staticcheck (pull_request) Successful in 6m20s
Tests and linters / Lint (pull_request) Successful in 6m51s
Pre-commit hooks / Pre-commit (pull_request) Successful in 8m44s
Tests and linters / Tests with -race (pull_request) Successful in 11m1s
Tests and linters / Tests (1.21) (pull_request) Successful in 11m22s
Tests and linters / Tests (1.22) (pull_request) Successful in 12m3s
Tests and linters / gopls check (pull_request) Successful in 2m33s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
package container
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
|
containerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/container"
|
|
"github.com/mr-tron/base58"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func (cp *Processor) handlePut(ev event.Event) {
|
|
put := ev.(putEvent)
|
|
|
|
id := sha256.Sum256(put.Container())
|
|
cp.log.Info(logs.Notification,
|
|
zap.String("type", "container put"),
|
|
zap.String("id", base58.Encode(id[:])))
|
|
|
|
// send an event to the worker pool
|
|
|
|
err := processors.SubmitEvent(cp.pool, cp.metrics, "container_put", func() bool {
|
|
return cp.processContainerPut(put)
|
|
})
|
|
if err != nil {
|
|
// there system can be moved into controlled degradation stage
|
|
cp.log.Warn(logs.ContainerContainerProcessorWorkerPoolDrained,
|
|
zap.Int("capacity", cp.pool.Cap()))
|
|
}
|
|
}
|
|
|
|
func (cp *Processor) handleDelete(ev event.Event) {
|
|
del := ev.(containerEvent.Delete)
|
|
cp.log.Info(logs.Notification,
|
|
zap.String("type", "container delete"),
|
|
zap.String("id", base58.Encode(del.ContainerID())))
|
|
|
|
// send an event to the worker pool
|
|
|
|
err := processors.SubmitEvent(cp.pool, cp.metrics, "container_delete", func() bool {
|
|
return cp.processContainerDelete(del)
|
|
})
|
|
if err != nil {
|
|
// there system can be moved into controlled degradation stage
|
|
cp.log.Warn(logs.ContainerContainerProcessorWorkerPoolDrained,
|
|
zap.Int("capacity", cp.pool.Cap()))
|
|
}
|
|
}
|
|
|
|
func (cp *Processor) handleSetEACL(_ event.Event) {
|
|
cp.log.Warn(logs.SkipDeprecatedNotification, zap.String("type", "set EACL"))
|
|
}
|