def is_alive_ds(self, ds_ip, ds_port): key = ds_alive_key() item = '%s:%d' % (ds_ip, ds_port) lists = self.get(key) ret = False if item in lists: ret = True return ret
def del_alive_ds(self, ds_ip, ds_port): key = ds_alive_key() item = '%s:%d' % (ds_ip, ds_port) lists = self.get(key) ret = True if item in lists: lists.remove(item) ret = self.set(key, lists) return ret
def add_alive_ds(self, ds_ip, ds_port): key = ds_alive_key() item = '%s:%d' % (ds_ip, ds_port) lists = self.get(key) if not lists: lists = [] ret = True if item not in lists: lists.append(item) ret = self.set(key, lists) return ret
def get_alive_ds(self): key = ds_alive_key() lists = self.get(key) return lists
def test_ds_alive_key(): key = ds_alive_key() eq_(key, 'ds_alive')