def __init__(self, factory, realm, options=None, store=None): """ :param factory: The router factory this router was created by. :type factory: Object that implements :class:`autobahn.wamp.interfaces.IRouterFactory`.. :param realm: The realm this router is working for. :type realm: str :param options: Router options. :type options: Instance of :class:`autobahn.wamp.types.RouterOptions`. """ self._factory = factory self._options = options or RouterOptions() self._store = store self._realm = realm self.realm = realm.config[u'name'] self._trace_traffic = False self._trace_traffic_roles_include = None self._trace_traffic_roles_exclude = [u'trusted'] # map: session_id -> session self._session_id_to_session = {} self._broker = self.broker(self, self._options) self._dealer = self.dealer(self, self._options) self._attached = 0 self._roles = {u'trusted': RouterTrustedRole(self, u'trusted')}
def __init__(self, factory, realm, options: Optional[RouterOptions] = None, store: Optional[IRealmStore] = None, inventory: Optional[IInventory] = None): """ :param factory: The router factory this router was created by. :type factory: Object that implements :class:`autobahn.wamp.interfaces.IRouterFactory`. :param realm: The realm this router is working for. :type realm: Instance of :class:`crossbar.worker.router.RouterRealm`. :param options: Router options. :param store: Router realm store to use (optional). """ self._factory = factory self._realm = realm self._options = options or RouterOptions() self._store: Optional[IRealmStore] = store self._inventory: Optional[IInventory] = inventory self.realm = realm.config['name'] self._trace_traffic = False self._trace_traffic_roles_include = None self._trace_traffic_roles_exclude = ['trusted'] # map: session_id -> session self._session_id_to_session: Dict[int, ISession] = {} # map: authid -> set(session) self._authid_to_sessions: Dict[str, Set[ISession]] = {} # map: authrole -> set(session) self._authrole_to_sessions: Dict[str, Set[ISession]] = {} # map: (realm, authrole, uri, action) -> authorization self._authorization_cache: Dict[Tuple[str, str, str, str], Dict[str, Any]] = {} self._broker = self.broker(self, factory._reactor, self._options) self._dealer = self.dealer(self, factory._reactor, self._options) self._attached = 0 self._roles = {'trusted': RouterTrustedRole(self, 'trusted')} # FIXME: this was previously just checking for existence of # self._factory._worker._maybe_trace_tx_msg / _maybe_trace_rx_msg self._is_traced = False self.reset_stats()
def __init__(self, factory, realm, options=None, store=None): """ :param factory: The router factory this router was created by. :type factory: Object that implements :class:`autobahn.wamp.interfaces.IRouterFactory`.. :param realm: The realm this router is working for. :type realm: str :param options: Router options. :type options: Instance of :class:`crossbar.router.RouterOptions`. """ self._factory = factory self._options = options or RouterOptions() self._store = store self._realm = realm self.realm = realm.config[u'name'] self._trace_traffic = False self._trace_traffic_roles_include = None self._trace_traffic_roles_exclude = [u'trusted'] # map: session_id -> session self._session_id_to_session = {} # map: authid -> set(session) self._authid_to_sessions = {} # map: authrole -> set(session) self._authrole_to_sessions = {} self._broker = self.broker(self, factory._reactor, self._options) self._dealer = self.dealer(self, factory._reactor, self._options) self._attached = 0 self._roles = { u'trusted': RouterTrustedRole(self, u'trusted') } # FIXME: this was previsouly just checking for existence of # self._factory._worker._maybe_trace_tx_msg / _maybe_trace_rx_msg self._is_traced = False self.reset_stats()