def create_db_server_manager(trinity_config: TrinityConfig, base_db: BaseAtomicDB) -> BaseManager: app_config = trinity_config.get_app_config(BeaconAppConfig) chain_config = app_config.get_chain_config() chaindb = BeaconChainDB(base_db) if not is_beacon_database_initialized(chaindb, BeaconBlock): initialize_beacon_database(chain_config, chaindb, base_db, BeaconBlock) class DBManager(BaseManager): pass DBManager.register('get_db', callable=lambda: TracebackRecorder(base_db), proxytype=AsyncDBProxy) DBManager.register( 'get_chaindb', callable=lambda: TracebackRecorder(chaindb), proxytype=AsyncBeaconChainDBProxy, ) manager = DBManager(address=str( trinity_config.database_ipc_path)) # type: ignore return manager
def create_db_server_manager(trinity_config: TrinityConfig, base_db: BaseAtomicDB) -> BaseManager: app_config = trinity_config.get_app_config(BeaconAppConfig) chain_config = app_config.get_chain_config() chaindb = BeaconChainDB(base_db, chain_config.genesis_config) if not is_beacon_database_initialized(chaindb, BeaconBlock): initialize_beacon_database(chain_config, chaindb, base_db, BeaconBlock) # This enables connection when clients launch from another process on the shell multiprocessing.current_process().authkey = AUTH_KEY class DBManager(BaseManager): pass DBManager.register('get_db', callable=lambda: TracebackRecorder(base_db), proxytype=AsyncDBProxy) DBManager.register( 'get_chaindb', callable=lambda: TracebackRecorder(chaindb), proxytype=AsyncBeaconChainDBProxy, ) manager = DBManager(address=str( trinity_config.database_ipc_path)) # type: ignore return manager
def create_db_server_manager(trinity_config: TrinityConfig, base_db: BaseAtomicDB) -> BaseManager: chain_config = trinity_config.get_chain_config() chaindb = ChainDB(base_db) if not is_database_initialized(chaindb): initialize_database(chain_config, chaindb, base_db) headerdb = HeaderDB(base_db) class DBManager(BaseManager): pass DBManager.register('get_db', callable=lambda: TracebackRecorder(base_db), proxytype=AsyncDBProxy) DBManager.register( 'get_chaindb', callable=lambda: TracebackRecorder(chaindb), proxytype=AsyncChainDBProxy, ) DBManager.register( 'get_headerdb', callable=lambda: TracebackRecorder(headerdb), proxytype=AsyncHeaderDBProxy, ) manager = DBManager(address=str( trinity_config.database_ipc_path)) # type: ignore return manager
def create_db_server_manager(trinity_config: TrinityConfig, base_db: BaseAtomicDB) -> BaseManager: chaindb = BeaconChainDB(base_db) # TODO: handle initialization class DBManager(BaseManager): pass DBManager.register('get_db', callable=lambda: TracebackRecorder(base_db), proxytype=AsyncDBProxy) DBManager.register( 'get_chaindb', callable=lambda: TracebackRecorder(chaindb), proxytype=AsyncBeaconChainDBProxy, ) manager = DBManager(address=str( trinity_config.database_ipc_path)) # type: ignore return manager