コード例 #1
0
class NamespaceApp(object):
    def __init__(self):
        self._ns_manager = NamespaceManager()

    def list_namespaces(self):
        return self._ns_manager.get_all_namespaces()

    def get_namespace(self, namespace):
        return self._ns_manager.get_namespace(namespace)

    def list_namespaces_ips(self):
        return self._ns_manager.get_all_namespaces_ips()
コード例 #2
0
class NamespaceApp(StateLessBaseApp):

    NAME = "NAMESPACE"

    def __init__(self):
        self._ns_manager = NamespaceManager()

    @exposed
    def list_namespaces(self):
        return self._ns_manager.get_all_namespaces()

    @exposed
    def get_namespace(self, namespace):
        return self._ns_manager.get_namespace(namespace)

    @exposed
    def list_namespaces_ips(self):
        return self._ns_manager.get_all_namespaces_ips()
コード例 #3
0
 def __init__(self, config):
     self.log = logging.getLogger(__name__)
     self._conf = config
     self._cs_db = ConnectedStateProcessor(DBConnectedState())
     namespaces = NamespaceManager().get_all_namespaces()
     if namespaces and self._conf.NAMESPACE_MODE:
         self.namespace_mode = True
         self._server_agent = AxonNameSpaceServerAgent()
         self._client_agent = AxonNameSpaceClientAgent()
     else:
         self.namespace_mode = False
         self._server_agent = AxonRootNamespaceServerAgent()
         self._client_agent = AxonRootNamespaceClientAgent()
コード例 #4
0
 def __init__(self, config):
     self.log = logging.getLogger(__name__)
     self._conf = config
     self._cs_db = ConnectedStateProcessor(DBConnectedState())
     namespaces = NamespaceManager().get_all_namespaces()
     record_queue = Queue(RECORD_QUEUE_SIZE)
     if namespaces and self._conf.NAMESPACE_MODE:
         self.namespace_mode = True
         self._server_agent = AxonNameSpaceServerAgent()
         self._client_agent = AxonNameSpaceClientAgent(record_queue)
     else:
         self.namespace_mode = False
         self._server_agent = AxonRootNamespaceServerAgent()
         self._client_agent = AxonRootNamespaceClientAgent(record_queue)
     self._start_db_pool_manager(record_queue)
コード例 #5
0
 def __init__(self, config, record_queue=None):
     self.log = logging.getLogger(__name__)
     self._conf = config
     self._cs_db = ConnectedStateProcessor(DBConnectedState())
     namespaces = NamespaceManager().get_all_namespaces()
     record_queue = Queue(
         RECORD_QUEUE_SIZE) if record_queue is None else record_queue
     if self._conf.NAMESPACE_MODE:
         if not namespaces:
             self.log.warning(
                 "No namespace is found but NAMESPACE_MODE "
                 "is set to True on config file. Create namespace(s) "
                 "and run rediscover_namespaces")
         self.namespace_mode = True
         self._server_agent = AxonNameSpaceServerAgent()
         self._client_agent = AxonNameSpaceClientAgent(record_queue)
     else:
         self.namespace_mode = False
         self._server_agent = AxonRootNamespaceServerAgent()
         self._client_agent = AxonRootNamespaceClientAgent(record_queue)
     self._start_db_pool_manager(record_queue)
コード例 #6
0
 def _setup(self):
     if not self._ns_list or not self._ns_iterface_map:
         mngr = NamespaceManager()
         self._ns_list = mngr.get_all_namespaces()
         self._ns_iterface_map = mngr.get_namespace_interface_map()
コード例 #7
0
 def __init__(self):
     self._ns_manager = NamespaceManager()
コード例 #8
0
 def rediscover_namespaces(self):
     self._ns_list, self._ns_iterface_map = None, None
     mngr = NamespaceManager()
     mngr.discover_namespaces()
     self._ns_list = mngr.get_all_namespaces()
     self._ns_iterface_map = mngr.get_namespace_interface_map()