frostfs-node/pkg/innerring/processors/reputation/handlers.go
Alex Vanin 20de74a505 Rename package name
Due to source code relocation from GitHub.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2023-03-07 16:38:26 +03:00

28 lines
808 B
Go

package reputation
import (
"encoding/hex"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
reputationEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/reputation"
"go.uber.org/zap"
)
func (rp *Processor) handlePutReputation(ev event.Event) {
put := ev.(reputationEvent.Put)
peerID := put.PeerID()
// FIXME: #1147 do not use `ToV2` method outside frostfs-api-go library
rp.log.Info("notification",
zap.String("type", "reputation put"),
zap.String("peer_id", hex.EncodeToString(peerID.PublicKey())))
// send event to the worker pool
err := rp.pool.Submit(func() { rp.processPut(&put) })
if err != nil {
// there system can be moved into controlled degradation stage
rp.log.Warn("reputation worker pool drained",
zap.Int("capacity", rp.pool.Cap()))
}
}