[#428] cmd/node: Trigger local trust controller on new epoch

Implement and call `initReputationService` func that constructs local trust
storage and controller, and subscribes the controller on new epoch
notification. Event handler calls `Controller.Report` method to process
collected values.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-03-23 21:54:00 +03:00 committed by Leonard Lyubich
parent c4a1c70089
commit a6f2394dec
3 changed files with 43 additions and 0 deletions

View file

@ -32,6 +32,8 @@ import (
netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
"github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
trustcontroller "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/controller"
truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage"
tokenStorage "github.com/nspcc-dev/neofs-node/pkg/services/session/storage"
"github.com/nspcc-dev/neofs-node/pkg/services/util/response"
util2 "github.com/nspcc-dev/neofs-node/pkg/util"
@ -200,6 +202,8 @@ type cfg struct {
healthStatus *atomic.Int32
closers []func()
cfgReputation cfgReputation
}
type cfgGRPC struct {
@ -287,6 +291,12 @@ type cfgControlService struct {
server *grpc.Server
}
type cfgReputation struct {
localTrustStorage *truststorage.Storage
localTrustCtrl *trustcontroller.Controller
}
const (
_ BootstrapType = iota
StorageNode