def get_part_alloc(self, space_name): with self._lock: if space_name not in self._space_caches.keys(): self._load_all() if space_name not in self._space_caches.keys(): raise SpaceNotFoundException(space_name) return self._space_caches[space_name].parts_alloc
def get_part_leaders(self, space_name): with self._lock: if space_name not in self._storage_leader.keys(): self._load_all() if space_name not in self._storage_leader.keys(): raise SpaceNotFoundException(space_name) return self._storage_leader[space_name]
def _get_edge_item(self, space_name, edge_name): with self._lock: if space_name not in self._space_caches.keys(): self._load_all() if space_name not in self._space_caches.keys(): raise SpaceNotFoundException(space_name) space_info = self._space_caches[space_name] if edge_name not in space_info.edge_items.keys(): self._load_all() if edge_name not in space_info.edge_items.keys(): raise EdgeNotFoundException(edge_name) return space_info.edge_items[edge_name]
def _get_tag_item(self, space_name, tag_name): with self._lock: if space_name not in self._space_caches.keys(): self._load_all() if space_name not in self._space_caches.keys(): raise SpaceNotFoundException(space_name) space_info = self._space_caches[space_name] if tag_name not in space_info.tag_items.keys(): self._load_all() if tag_name not in space_info.tag_items.keys(): raise TagNotFoundException(tag_name) return space_info.tag_items[tag_name]
def get_space_id(self, space_name): """ get_space_id :param space_name: :return: space_id """ with self._lock: if space_name not in self._space_caches.keys(): self._load_all() if space_name not in self._space_caches.keys(): raise SpaceNotFoundException(space_name) return self._space_caches[space_name].space_id
def get_part_alloc(self, space_name): """get all part info of the space :param space_name: space name :eturn: map<PartitionID, list<HostAddr>> """ with self._lock: if space_name not in self._space_caches.keys(): self._load_all() if space_name not in self._space_caches.keys(): raise SpaceNotFoundException(space_name) return self._space_caches[space_name].parts_alloc
def get_part_leaders(self, space_name): """get all part leader info of the space :param space_name: space name :eturn: map<PartitionID, HostAddr> """ with self._lock: if space_name not in self._storage_leader.keys(): self._load_all() if space_name not in self._storage_leader.keys(): raise SpaceNotFoundException(space_name) return self._storage_leader[space_name]