Exemplo n.º 1
0
    def __init__(self, router, options=None):
        """

        :param router: The router this dealer is part of.
        :type router: Object that implements :class:`crossbar.router.interfaces.IRouter`.
        :param options: Router options.
        :type options: Instance of :class:`crossbar.router.types.RouterOptions`.
        """
        self._router = router
        self._options = options or RouterOptions()

        # subscription map managed by this broker
        self._subscription_map = UriObservationMap()

        # map: session -> set of subscriptions (needed for detach)
        self._session_to_subscriptions = {}

        # check all topic URIs with strict rules
        self._option_uri_strict = self._options.uri_check == RouterOptions.URI_CHECK_STRICT

        # supported features from "WAMP Advanced Profile"
        self._role_features = role.RoleBrokerFeatures(publisher_identification=True,
                                                      pattern_based_subscription=True,
                                                      subscription_meta_api=True,
                                                      subscriber_blackwhite_listing=True,
                                                      publisher_exclusion=True,
                                                      subscription_revocation=True)
Exemplo n.º 2
0
    def __init__(self, router, options=None):
        """

        :param router: The router this dealer is part of.
        :type router: Object that implements :class:`crossbar.router.interfaces.IRouter`.
        :param options: Router options.
        :type options: Instance of :class:`crossbar.router.types.RouterOptions`.
        """
        self._router = router
        self._options = options or RouterOptions()

        # registration map managed by this dealer
        self._registration_map = UriObservationMap(ordered=True)

        # map: session -> set of registrations (needed for detach)
        self._session_to_registrations = {}

        # pending callee invocation requests
        self._invocations = {}

        # check all procedure URIs with strict rules
        self._option_uri_strict = self._options.uri_check == RouterOptions.URI_CHECK_STRICT

        # supported features from "WAMP Advanced Profile"
        self._role_features = role.RoleDealerFeatures(caller_identification=True,
                                                      pattern_based_registration=True,
                                                      registration_meta_api=True,
                                                      shared_registration=True,
                                                      progressive_call_results=True,
                                                      registration_revocation=True)
Exemplo n.º 3
0
   def __init__(self, router, options):
      """

      :param router: The router this dealer is part of.
      :type router: Object that implements :class:`crossbar.router.interfaces.IRouter`.
      :param options: Router options.
      :type options: Instance of :class:`crossbar.router.types.RouterOptions`.
      """
      self._router = router
      self._options = options or RouterOptions()

      ## map: session -> set(registration)
      ## needed for removeSession
      self._session_to_registrations = {}

      ## map: session_id -> session
      ## needed for exclude/eligible
      self._session_id_to_session = {}

      ## map: procedure -> (registration, session)
      self._procs_to_regs = {}

      ## map: registration -> procedure
      self._regs_to_procs = {}

      ## pending callee invocation requests
      self._invocations = {}

      ## check all procedure URIs with strict rules
      self._option_uri_strict = self._options.uri_check == RouterOptions.URI_CHECK_STRICT

      ## supported features from "WAMP Advanced Profile"
      self._role_features = role.RoleDealerFeatures(caller_identification = True, progressive_call_results = True)
Exemplo n.º 4
0
    def __init__(self, router, options=None):
        """

      :param router: The router this dealer is part of.
      :type router: Object that implements :class:`crossbar.router.interfaces.IRouter`.
      :param options: Router options.
      :type options: Instance of :class:`crossbar.router.types.RouterOptions`.
      """
        self._router = router
        self._options = options or RouterOptions()

        ## map: session -> set(subscription)
        ## needed for removeSession
        self._session_to_subscriptions = {}

        ## map: session_id -> session
        ## needed for exclude/eligible
        self._session_id_to_session = {}

        ## map: topic -> (subscription, set(session))
        ## needed for PUBLISH and SUBSCRIBE
        self._topic_to_sessions = {}

        ## map: subscription -> (topic, set(session))
        ## needed for UNSUBSCRIBE
        self._subscription_to_sessions = {}

        ## check all topic URIs with strict rules
        self._option_uri_strict = self._options.uri_check == RouterOptions.URI_CHECK_STRICT

        ## supported features from "WAMP Advanced Profile"
        self._role_features = role.RoleBrokerFeatures(
            publisher_identification=True,
            subscriber_blackwhite_listing=True,
            publisher_exclusion=True)
Exemplo n.º 5
0
    def __init__(self, options=None, debug=False):
        """

      :param options: Default router options.
      :type options: Instance of :class:`autobahn.wamp.types.RouterOptions`.      
      """
        self._routers = {}
        self.debug = debug
        self._options = options or RouterOptions()
Exemplo n.º 6
0
   def start_from_config(self, config):

      controller_config = config.get('controller', {})

      controller_options = controller_config.get('options', {})

      controller_title = controller_options.get('title', 'crossbar-controller')

      try:
         import setproctitle
      except ImportError:
         log.msg("Warning, could not set process title (setproctitle not installed)")
      else:
         setproctitle.setproctitle(controller_title)


      ## the node's name (must be unique within the management realm)
      if 'id' in controller_config:
         self._node_id = controller_config['id']
      else:
         self._node_id = socket.gethostname()

      ## the node's management realm
      self._realm = controller_config.get('realm', 'crossbar')


      ## the node controller singleton WAMP application session
      ##
      #session_config = ComponentConfig(realm = options.realm, extra = options)

      self._controller = NodeControllerSession(self)

      ## router and factory that creates router sessions
      ##
      self._router_factory = RouterFactory(
         options = RouterOptions(uri_check = RouterOptions.URI_CHECK_LOOSE),
         debug = False)
      self._router_session_factory = RouterSessionFactory(self._router_factory)

      ## add the node controller singleton session to the router
      ##
      self._router_session_factory.add(self._controller)

      ## Detect WAMPlets
      ##
      wamplets = self._controller._get_wamplets()
      if len(wamplets) > 0:
         log.msg("Detected {} WAMPlets in environment:".format(len(wamplets)))
         for wpl in wamplets:
            log.msg("WAMPlet {}.{}".format(wpl['dist'], wpl['name']))
      else:
         log.msg("No WAMPlets detected in enviroment.")


      self.run_node_config(config)
Exemplo n.º 7
0
    def __init__(self, factory, realm, options=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.debug = False
        self.factory = factory
        self.realm = realm
        self._options = options or RouterOptions()
        self._broker = self.broker(self, self._options)
        self._dealer = self.dealer(self, self._options)
        self._attached = 0
Exemplo n.º 8
0
 def __init__(self, options=None, debug=False):
     """
     Ctor.
     """
     options = RouterOptions(uri_check=RouterOptions.URI_CHECK_LOOSE)
     RouterFactory.__init__(self, options, debug)