2021-03-31 15:38:01 +00:00
|
|
|
package reputation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/hex"
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
|
|
|
reputationEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/reputation"
|
2021-03-31 15:38:01 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (rp *Processor) handlePutReputation(ev event.Event) {
|
|
|
|
put := ev.(reputationEvent.Put)
|
2021-04-05 09:29:33 +00:00
|
|
|
peerID := put.PeerID()
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
// FIXME: #1147 do not use `ToV2` method outside frostfs-api-go library
|
2023-04-12 14:35:10 +00:00
|
|
|
rp.log.Info(logs.ReputationNotification,
|
2021-03-31 15:38:01 +00:00
|
|
|
zap.String("type", "reputation put"),
|
2022-07-04 13:24:51 +00:00
|
|
|
zap.String("peer_id", hex.EncodeToString(peerID.PublicKey())))
|
2021-03-31 15:38:01 +00:00
|
|
|
|
|
|
|
// send event to the worker pool
|
|
|
|
|
2021-09-08 15:20:02 +00:00
|
|
|
err := rp.pool.Submit(func() { rp.processPut(&put) })
|
2021-03-31 15:38:01 +00:00
|
|
|
if err != nil {
|
|
|
|
// there system can be moved into controlled degradation stage
|
2023-04-12 14:35:10 +00:00
|
|
|
rp.log.Warn(logs.ReputationReputationWorkerPoolDrained,
|
2021-03-31 15:38:01 +00:00
|
|
|
zap.Int("capacity", rp.pool.Cap()))
|
|
|
|
}
|
|
|
|
}
|