private void InitDiscovery() { _configProvider.GetConfig <INetworkConfig>().MasterPort = _initConfig.DiscoveryPort; var privateKeyProvider = new PrivateKeyProvider(_privateKey); var discoveryMessageFactory = new DiscoveryMessageFactory(_configProvider); var nodeIdResolver = new NodeIdResolver(_signer); IDiscoveryMsgSerializersProvider msgSerializersProvider = new DiscoveryMsgSerializersProvider( _messageSerializationService, _signer, privateKeyProvider, discoveryMessageFactory, nodeIdResolver, _nodeFactory); msgSerializersProvider.RegisterDiscoverySerializers(); var nodeDistanceCalculator = new NodeDistanceCalculator(_configProvider); var nodeTable = new NodeTable( _nodeFactory, _keyStore, nodeDistanceCalculator, _configProvider, _logManager); var evictionManager = new EvictionManager( nodeTable, _logManager); var nodeLifeCycleFactory = new NodeLifecycleManagerFactory( _nodeFactory, nodeTable, discoveryMessageFactory, evictionManager, _nodeStatsProvider, _configProvider, _logManager); var discoveryStorage = new NetworkStorage( DiscoveryNodesDbPath, _configProvider.GetConfig <INetworkConfig>(), _logManager, _perfService); _discoveryManager = new DiscoveryManager( nodeLifeCycleFactory, _nodeFactory, nodeTable, discoveryStorage, _configProvider, _logManager); var nodesLocator = new NodesLocator( nodeTable, _discoveryManager, _configProvider, _logManager); _discoveryApp = new DiscoveryApp( nodesLocator, _discoveryManager, _nodeFactory, nodeTable, _messageSerializationService, _cryptoRandom, discoveryStorage, _configProvider, _logManager, _perfService); _discoveryApp.Initialize(_privateKey.PublicKey); }
private void InitDiscovery() { if (!_initConfig.DiscoveryEnabled) { _discoveryApp = new NullDiscoveryApp(); return; } INetworkConfig networkConfig = _configProvider.GetConfig <INetworkConfig>(); networkConfig.MasterPort = _initConfig.DiscoveryPort; var privateKeyProvider = new SameKeyGenerator(_nodeKey); var discoveryMessageFactory = new DiscoveryMessageFactory(networkConfig, _timestamp); var nodeIdResolver = new NodeIdResolver(_ecdsa); IDiscoveryMsgSerializersProvider msgSerializersProvider = new DiscoveryMsgSerializersProvider( _messageSerializationService, _ecdsa, privateKeyProvider, discoveryMessageFactory, nodeIdResolver); msgSerializersProvider.RegisterDiscoverySerializers(); var nodeDistanceCalculator = new NodeDistanceCalculator(networkConfig); var nodeTable = new NodeTable( _keyStore, nodeDistanceCalculator, networkConfig, _logManager); var evictionManager = new EvictionManager( nodeTable, _logManager); var nodeLifeCycleFactory = new NodeLifecycleManagerFactory( nodeTable, discoveryMessageFactory, evictionManager, _nodeStatsManager, networkConfig, _logManager); var discoveryStorage = new NetworkStorage( DiscoveryNodesDbPath, networkConfig, _logManager, _perfService); var discoveryManager = new DiscoveryManager( nodeLifeCycleFactory, nodeTable, discoveryStorage, networkConfig, _logManager); var nodesLocator = new NodesLocator( nodeTable, discoveryManager, _configProvider, _logManager); _discoveryApp = new DiscoveryApp( nodesLocator, discoveryManager, nodeTable, _messageSerializationService, _cryptoRandom, discoveryStorage, networkConfig, _logManager, _perfService); _discoveryApp.Initialize(_nodeKey.PublicKey); }
private void InitDiscovery() { if (!_initConfig.DiscoveryEnabled) { _discoveryApp = new NullDiscoveryApp(); return; } IDiscoveryConfig discoveryConfig = _configProvider.GetConfig <IDiscoveryConfig>(); var privateKeyProvider = new SameKeyGenerator(_nodeKey); var discoveryMessageFactory = new DiscoveryMessageFactory(_timestamper); var nodeIdResolver = new NodeIdResolver(_ethereumEcdsa); IDiscoveryMsgSerializersProvider msgSerializersProvider = new DiscoveryMsgSerializersProvider( _messageSerializationService, _ethereumEcdsa, privateKeyProvider, discoveryMessageFactory, nodeIdResolver); msgSerializersProvider.RegisterDiscoverySerializers(); var nodeDistanceCalculator = new NodeDistanceCalculator(discoveryConfig); var nodeTable = new NodeTable(nodeDistanceCalculator, discoveryConfig, _networkConfig, _logManager); var evictionManager = new EvictionManager(nodeTable, _logManager); var nodeLifeCycleFactory = new NodeLifecycleManagerFactory( nodeTable, discoveryMessageFactory, evictionManager, _nodeStatsManager, discoveryConfig, _logManager); var discoveryDb = new SimpleFilePublicKeyDb("DiscoveryDB", Path.Combine(_initConfig.BaseDbPath, DiscoveryNodesDbPath), _logManager); var discoveryStorage = new NetworkStorage( discoveryDb, _logManager); var discoveryManager = new DiscoveryManager( nodeLifeCycleFactory, nodeTable, discoveryStorage, discoveryConfig, _logManager); var nodesLocator = new NodesLocator( nodeTable, discoveryManager, discoveryConfig, _logManager); _discoveryApp = new DiscoveryApp( nodesLocator, discoveryManager, nodeTable, _messageSerializationService, _cryptoRandom, discoveryStorage, _networkConfig, discoveryConfig, _timestamper, _logManager, _perfService); _discoveryApp.Initialize(_nodeKey.PublicKey); }