def read(): c = StoreClient('test', [('n1', 6666)]) missing = [] for k in range(1, 501): val = c.get(str(k)) if not val: #print k missing.append(k) return missing
def read(): c = StoreClient('test', [('n2', 6668)]) missing = [] for k in range(1, 2001): try: val = c.get(str(k)) if not val: #print k missing.append(k) except VoldemortEcxeption: #print "Ecxeption caught, retry..." sleep(1) return missing
import logging import time from voldemort import StoreClient if __name__ == '__main__': logging.basicConfig(level=logging.INFO,) ## some random tests s = StoreClient('test', [('localhost', 6666)]) version = s.put("hello", "1") assert s.get("hello")[0][0] == "1" s.put("hello", "2", version) assert s.get("hello")[0][0] == "2" s.put("hello", "3") assert s.get("hello")[0][0] == "3" s.delete("hello") assert len(s.get("hello")) == 0 ## test get_all pairs = [("a1", "1"), ("a2", "2"), ("a3", "3"), ("a4", "4")] for k, v in pairs: s.put(k, v) vals = s.get_all([k for k, v in pairs]) for k, v in pairs: assert vals[k][0][0] == v requests = 10000 ## Time get requests