github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/collection/epochmgr/factories/hub.go (about) 1 package factories 2 3 import ( 4 "github.com/rs/zerolog" 5 6 "github.com/onflow/flow-go/consensus" 7 "github.com/onflow/flow-go/engine/collection" 8 "github.com/onflow/flow-go/engine/collection/message_hub" 9 "github.com/onflow/flow-go/module" 10 "github.com/onflow/flow-go/network" 11 "github.com/onflow/flow-go/state/cluster" 12 "github.com/onflow/flow-go/state/protocol" 13 "github.com/onflow/flow-go/storage" 14 ) 15 16 type MessageHubFactory struct { 17 log zerolog.Logger 18 me module.Local 19 net network.EngineRegistry 20 protoState protocol.State 21 engineMetrics module.EngineMetrics 22 } 23 24 func NewMessageHubFactory(log zerolog.Logger, 25 net network.EngineRegistry, 26 me module.Local, 27 engineMetrics module.EngineMetrics, 28 protoState protocol.State) *MessageHubFactory { 29 return &MessageHubFactory{ 30 log: log, 31 me: me, 32 net: net, 33 protoState: protoState, 34 engineMetrics: engineMetrics, 35 } 36 } 37 38 func (f *MessageHubFactory) Create( 39 clusterState cluster.State, 40 payloads storage.ClusterPayloads, 41 hotstuff module.HotStuff, 42 compliance collection.Compliance, 43 hotstuffModules *consensus.HotstuffModules, 44 ) (*message_hub.MessageHub, error) { 45 return message_hub.NewMessageHub( 46 f.log, 47 f.engineMetrics, 48 f.net, 49 f.me, 50 compliance, 51 hotstuff, 52 hotstuffModules.VoteAggregator, 53 hotstuffModules.TimeoutAggregator, 54 f.protoState, 55 clusterState, 56 payloads, 57 ) 58 }