def do_start(self) -> None: loop = asyncio.get_event_loop() service = PeerCountReporter(self.event_bus) asyncio.ensure_future(exit_with_service_and_endpoint(service, self.event_bus)) asyncio.ensure_future(service.run()) loop.run_forever() loop.close()
def do_start(self) -> None: db_manager = create_db_manager(self.context.trinity_config.database_ipc_path) db_manager.connect() trinity_config = self.context.trinity_config chain_config = trinity_config.get_chain_config() chain: BaseAsyncChain if self.context.trinity_config.is_light_mode: header_db = db_manager.get_headerdb() # type: ignore event_bus_light_peer_chain = EventBusLightPeerChain(self.context.event_bus) chain = chain_config.light_chain_class(header_db, peer_chain=event_bus_light_peer_chain) elif trinity_config.is_full_mode: db = db_manager.get_db() # type: ignore chain = chain_config.full_chain_class(db) else: raise NotImplementedError(f"Unsupported mode: {trinity_config.sync_mode}") rpc = RPCServer(chain, self.context.event_bus) ipc_server = IPCServer(rpc, self.context.trinity_config.jsonrpc_ipc_path) loop = asyncio.get_event_loop() asyncio.ensure_future(exit_with_service_and_endpoint(ipc_server, self.context.event_bus)) asyncio.ensure_future(ipc_server.run()) loop.run_forever() loop.close()
def _start(self) -> None: db_manager = create_db_manager( self.context.trinity_config.database_ipc_path) db_manager.connect() chain_class = self.context.trinity_config.node_class.chain_class if self.context.trinity_config.sync_mode == SYNC_LIGHT: header_db = db_manager.get_headerdb() # type: ignore event_bus_light_peer_chain = EventBusLightPeerChain( self.context.event_bus) chain = chain_class(header_db, peer_chain=event_bus_light_peer_chain) else: db = db_manager.get_db() # type: ignore chain = chain_class(db) rpc = RPCServer(chain, self.context.event_bus) ipc_server = IPCServer(rpc, self.context.trinity_config.jsonrpc_ipc_path) loop = asyncio.get_event_loop() asyncio.ensure_future( exit_with_service_and_endpoint(ipc_server, self.context.event_bus)) asyncio.ensure_future(ipc_server.run()) loop.run_forever() loop.close()
def do_start(self) -> None: service = EthstatsService( self.context, self.server_url, self.server_secret, self.node_id, self.node_contact, ) loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() asyncio.ensure_future(exit_with_service_and_endpoint(service, self.context.event_bus)) asyncio.ensure_future(service.run()) loop.run_forever() loop.close()
def start(self) -> None: self.logger.info('Ethstats service started') self.context.event_bus.connect() service = EthstatsService( self.context, self.context.args.ethstats_server_url, self.context.args.ethstats_server_secret, self.context.args.ethstats_node_id, self.context.args.ethstats_node_contact, ) loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() asyncio.ensure_future( exit_with_service_and_endpoint(service, self.context.event_bus)) asyncio.ensure_future(service.run()) loop.run_forever() loop.close()