frostfs-node/pkg/innerring/processors/reputation/handlers.go
Evgenii Stratonikov 0e31c12e63 [#240] logs: Move log messages to constants
Drop duplicate entities.
Format entities.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-04-14 05:06:09 +00:00

29 lines
891 B
Go

package reputation
import (
"encoding/hex"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"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(logs.ReputationNotification,
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(logs.ReputationReputationWorkerPoolDrained,
zap.Int("capacity", rp.pool.Cap()))
}
}