def __init__(self, config=None, reactor=None, personality=None): # base ctor WorkerController.__init__(self, config=config, reactor=reactor, personality=personality) # factory for producing (per-realm) routers self._router_factory = self.router_factory_class(None, self) # factory for producing router sessions self._router_session_factory = RouterSessionFactory(self._router_factory) # map: realm ID -> RouterRealm self.realms = {} # map: realm URI -> realm ID self.realm_to_id = {} # map: component ID -> RouterComponent self.components = {} # "global" shared between all components self.components_shared = { u'reactor': reactor } # map: transport ID -> RouterTransport self.transports = {}
def __init__(self, config=None, reactor=None, personality=None): # base ctor WorkerController.__init__(self, config=config, reactor=reactor, personality=personality) # factory for producing (per-realm) routers self._router_factory = self.router_factory_class(None, self) # factory for producing router sessions self._router_session_factory = RouterSessionFactory( self._router_factory) # map: realm ID -> RouterRealm self.realms = {} # map: realm URI -> realm ID self.realm_to_id = {} # map: component ID -> RouterComponent self.components = {} # "global" shared between all components self.components_shared = {u'reactor': reactor} # map: transport ID -> RouterTransport self.transports = {}
def __init__(self, config=None, reactor=None, personality=None): # base ctor WorkerController.__init__(self, config=config, reactor=reactor, personality=personality) # map: component ID -> ContainerComponent self.components = {} # when shall we exit? self._exit_mode = (config.extra.shutdown or self.SHUTDOWN_MANUAL) # "global" shared between all components self.components_shared = { u'reactor': reactor }
def __init__(self, config=None, reactor=None, personality=None): # WorkerController derives of NativeProcess, which will set self._reactor WorkerController.__init__(self, config=config, reactor=reactor, personality=personality) worker_options_extra = dict(config.extra.extra) self._database_config = worker_options_extra['database'] self._blockchain_config = worker_options_extra['blockchain'] self._ipfs_files_directory = worker_options_extra.get('ipfs_files_directory', './.ipfs_files') # xbrmm worker status self._status = None # map of market makers by ID self._makers = {} self._maker_adr2id = {} # open xbrmm worker database, containing a replicate of xbr on-chain data (other than # channels, which are market specific and stored in the market maker database of the maker of that market) self._dbpath = os.path.abspath( self._database_config.get('dbpath', './.xbrmm-{}-db'.format(config.extra.worker))) self._db = zlmdb.Database(dbpath=self._dbpath, maxsize=self._database_config.get('maxsize', 2**30), readonly=False, sync=True) self._db.__enter__() # generic database object metadata self._meta = cfxdb.meta.Schema.attach(self._db) # xbr database schema self._xbr = cfxdb.xbr.Schema.attach(self._db) # xbr market maker schema self._xbrmm = cfxdb.xbrmm.Schema.attach(self._db) # event object too coordinate exit of blockchain monitor background check self._run_monitor = None # blockchain gateway configuration self._bc_gw_config = self._blockchain_config['gateway'] self.log.info('Initializing Web3 from blockchain gateway configuration\n\n{gateway}\n', gateway=pformat(self._bc_gw_config)) self._w3 = make_w3(self._bc_gw_config) xbr.setProvider(self._w3) self._chain_id = self._blockchain_config.get('chain_id', 1) self.log.info('Using chain ID {chain_id}', chain_id=hlid(self._chain_id)) # To be initiated once cbdir variable gets available self._ipfs_files_dir = os.path.join(config.extra.cbdir, self._ipfs_files_directory)
def __init__(self, config=None, reactor=None, personality=None): # base ctor WorkerController.__init__(self, config=config, reactor=reactor, personality=personality)