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()
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()
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()
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)
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)
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()
def __init__(self): self._ns_manager = NamespaceManager()
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()