Пример #1
0
    def Collection_Set(self, key):
        """
        """
        name = 'Collection_Set'
        attr = CollectionAttributes()
        attr.setExpireTime(ExpireTime)
        keyList = []
        for i in range(4):
            keyList.append(key + str(i))

        # SopInsert
        for i in range(4):
            for j in range(19):
                set_value = workloads[i] + str(j)
                future = self.client.asyncSopInsert(keyList[i], set_value,
                                                    attr)
                result = self.arcusGet(future, name=name)
                #print str(result)

        # SopInsert Bulk (Piped)
        elements = []
        for i in range(50):
            elements.append(str(i) + "_" + workloads[0])
        future = self.client.asyncSopPipedInsertBulk(key, elements,
                                                     CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # SopEmpty Create
        future = self.client.asyncSopCreate(key, ElementValueType.STRING,
                                            CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # SopExist    (Piped exist)
        for i in range(4):
            listValue = []
            for j in range(9):  # 10 value exsist
                listValue.append(workloads[i] + str(j))
            future = self.client.asyncSopPipedExistBulk(keyList[i], listValue)
            result = self.arcusGet(future, name=name)
            #print str(result)

        # SetAttr  (change Expire Time)
        attr.setExpireTime(100)
        future = self.client.asyncSetAttr(keyList[0], attr)
        result = self.arcusGet(future, name=name)
        #print str(result)

        # SopDelete
        for i in range(4):
            for j in range(4):  # 5 element value delete
                delValue = workloads[i] + str(j)
                future = self.client.asyncSopDelete(keyList[i], delValue, True)
                result = self.arcusGet(future, name=name)
Пример #2
0
    def Collection_Set(self, key):
        """
        """
        name = 'Collection_Set'
        attr = CollectionAttributes()
        attr.setExpireTime(ExpireTime)
        keyList = []
        for i in range(4):                  
            keyList.append(key + str(i))

        # SopInsert
        for i in range(4):
            for j in range(19):
                set_value = workloads[i] + str(j)
                future = self.client.asyncSopInsert(keyList[i], set_value, attr)
                result = self.arcusGet(future, name=name)
                #print str(result)

        # SopInsert Bulk (Piped)
        elements = []
        for i in range(50):
            elements.append(str(i) + "_" + workloads[0])                                                                                               
        future = self.client.asyncSopPipedInsertBulk(key, elements, CollectionAttributes())                                                 
        result = self.arcusGet(future, name=name)                                                                                                      
        #print str(result)            

        # SopEmpty Create
        future = self.client.asyncSopCreate(key, ElementValueType.STRING, CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # SopExist    (Piped exist)
        for i in range(4):
            listValue = []                                                                                                                             
            for j in range(9):   # 10 value exsist
                listValue.append(workloads[i] + str(j))
            future = self.client.asyncSopPipedExistBulk(keyList[i], listValue)
            result = self.arcusGet(future, name=name)
            #print str(result)

        # SetAttr  (change Expire Time)
        attr.setExpireTime(100)
        future = self.client.asyncSetAttr(keyList[0], attr)
        result = self.arcusGet(future, name=name)
        #print str(result)
         
        # SopDelete
        for i in range(4):
            for j in range(4):   # 5 element value delete
                delValue = workloads[i] + str(j)
                future = self.client.asyncSopDelete(keyList[i], delValue, True)
                result = self.arcusGet(future, name=name)
Пример #3
0
    def Collection_List(self, key):
        """
        """
        name = 'Collection_List'
        attr = CollectionAttributes()
        attr.setExpireTime(ExpireTime)
        keyList = []
        index = -1  # Tail insert
        for i in range(4):
            keyList.append(key + str(i))

        # LopInsert
        for i in range(4):
            for j in range(50):
                future = self.client.asyncLopInsert(keyList[i], index,
                                                    random.choice(workloads),
                                                    attr)
                result = self.arcusGet(future, name=name)
                #print str(result)

        # LopInsert Bulk (Piped)
        elements = []
        for i in range(50):
            elements.append(str(i) + "_" + workloads[0])
        future = self.client.asyncLopPipedInsertBulk(keyList[0], -1, elements,
                                                     CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # LopGet
        for i in range(4):
            index = 0
            index_to = index + random.randint(20, 50)
            future = self.client.asyncLopGet(keyList[i], index, index_to,
                                             False, False)
            result = self.arcusGet(future, name=name)
            #print str(result)

        # LopAttr
        attr.setExpireTime(100)
        future = self.client.asyncSetAttr(keyList[0], attr)
        result = self.arcusGet(future, name=name)
        #print str(result)

        # LopDelete
        index = 0
        index_to = 19
        for i in range(1):
            future = self.client.asyncLopDelete(keyList[i], index, index_to,
                                                True)
            result = self.arcusGet(future, name=name)
Пример #4
0
    def Collection_List(self, key):
        """
        """
        name = 'Collection_List'
        attr = CollectionAttributes()
        attr.setExpireTime(ExpireTime)
        keyList = []
        index = -1             # Tail insert
        for i in range(4):                  
            keyList.append(key + str(i))

        # LopInsert
        for i in range(4):
            for j in range(50):
                future = self.client.asyncLopInsert(keyList[i], index, random.choice(workloads), attr)
                result = self.arcusGet(future, name=name)
                #print str(result)

        # LopInsert Bulk (Piped)
        elements = []
        for i in range(50):
            elements.append(str(i) + "_" + workloads[0])
        future = self.client.asyncLopPipedInsertBulk(keyList[0], -1, elements, CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result) 
       
        # LopGet
        for i in range(4):
            index = 0
            index_to = index + random.randint(20, 50)
            future = self.client.asyncLopGet(keyList[i], index, index_to, False, False)
            result = self.arcusGet(future, name=name)
            #print str(result)   

        # LopAttr
        attr.setExpireTime(100)                                                                                                                     
        future = self.client.asyncSetAttr(keyList[0], attr)                                                                                            
        result = self.arcusGet(future, name=name)                                                                                                      
        #print str(result)        

        # LopDelete
        index = 0
        index_to = 19
        for i in range(1):
            future = self.client.asyncLopDelete(keyList[i], index, index_to, True)
            result = self.arcusGet(future, name=name)
Пример #5
0
    def Collection_Btree(self, key):
        """
        """
        name = 'Collection_Btree'
        keyList = []
        for i in range(4):  # Create 5 key
            keyList.append(key + str(i))

        bkeyBASE = "bkey_byteArry"

        eflag = String("EFLAG").getBytes()
        filter = ElementFlagFilter(ElementFlagFilter.CompOperands.Equal,
                                   String("EFLAG").getBytes())
        attr = CollectionAttributes()
        attr.setExpireTime(ExpireTime)

        # BopInsert + byte_array bkey
        for j in range(4):  # 5 Key
            for i in range(50):  # Insert 50 bkey
                bk = bkeyBASE + str(j) + str(i)  # Uniq bkey
                bkey = String(String.valueOf(bk)).getBytes()  ####____####
                future = self.client.asyncBopInsert(keyList[j], bkey, eflag,
                                                    random.choice(workloads),
                                                    attr)
                result = self.arcusGet(future, name=name)
                #print str(result)

        # Bop Bulk Insert (Piped Insert)
        elements = []
        for i in range(50):
            bk = bkeyBASE + str(0) + str(i) + "bulk"
            elements.append(
                Element(String(str(bk)).getBytes(), workloads[0],
                        eflag))  ####____####
        future = self.client.asyncBopPipedInsertBulk(keyList[0], elements,
                                                     CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # BopGet Range + filter
        for j in range(4):
            bk = bkeyBASE + str(j) + str(0)
            bk_to = bkeyBASE + str(j) + str(50)
            bkey = String(String.valueOf(bk)).getBytes()
            bkey_to = String(String.valueOf(bk_to)).getBytes()  ####____####
            future = self.client.asyncBopGet(keyList[j], bkey,
                                             bkey_to, filter, 0,
                                             random.randint(20,
                                                            50), False, False)
            result = self.arcusGet(future, name=name)
            #print str(result)

# BopGetBulk  // 20120319 Ad
        bk = bkeyBASE + str(0) + str(0)
        bk_to = bkeyBASE + str(4) + str(50)
        bkey = String(String.valueOf(bk)).getBytes()
        bkey_to = String(String.valueOf(bk_to)).getBytes()  ####____####
        future = self.client.asyncBopGetBulk(keyList, bkey, bkey_to, filter, 0,
                                             random.randint(20, 50))
        result = self.arcusGet(future, name=name)
        #for entry in result.entrySet():
        #	print str(entry.getKey())

        #	if entry.getValue().getElements() is not None:
        #		print "["
        #		for element in entry.getValue().getElements().entrySet():
        #			print "bkey=%s, value=%s" % (str(element.getKey()), str(element.getValue().getValue()))
        #		print "]"
        #	else:
        #		print "[elements=%s, response=%s]" % (entry.getValue().getElements(), entry.getValue().getCollectionResponse().getMessage())
        #print ""
        #print str(result)

        # BopEmpty Create
        future = self.client.asyncBopCreate(key, ElementValueType.STRING,
                                            CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # BopSMGet
        bk = bkeyBASE + str(0) + str(0)
        bk_to = bkeyBASE + str(4) + str(50)
        bkey = String(String.valueOf(bk)).getBytes()  ####____####
        bkey_to = String(String.valueOf(bk_to)).getBytes()  ####____####
        future = self.client.asyncBopSortMergeGet(keyList, bkey, bkey_to,
                                                  filter, 0,
                                                  random.randint(20, 50))
        result = self.arcusGet(future, name=name)
        #print str(result)

        # BopUpdate  (eflag bitOP + value)
        key = keyList[0]
        eflagOffset = 0
        value = "ThisIsChangeValue"
        bitop = ElementFlagUpdate(eflagOffset,
                                  ElementFlagFilter.BitWiseOperands.AND,
                                  String("aflag").getBytes())
        for i in range(2):  # 3 element update
            bk = bkeyBASE + str(0) + str(i)
            bkey = String(String.valueOf(bk)).getBytes()  ####____####
            future = self.client.asyncBopUpdate(key, bkey, bitop, value)
            result = self.arcusGet(future, name=name)
            #print str(result)

        # SetAttr  (change Expire Time)
        attr.setExpireTime(100)
        future = self.client.asyncSetAttr(key, attr)
        result = self.arcusGet(future, name=name)
        #print str(result)

        # BopDelete          (eflag filter delete)
        for j in range(4):
            bk = bkeyBASE + str(j) + str(0)
            bk_to = bkeyBASE + str(j) + str(10)
            bkey = String(String.valueOf(bk)).getBytes()  ####____####
            bkey_to = String(String.valueOf(bk_to)).getBytes()  ####____####
            future = self.client.asyncBopDelete(keyList[j], bkey, bkey_to,
                                                filter, 0, False)
            result = self.arcusGet(future, name=name)
Пример #6
0
    def Collection_Btree(self, key):
        """
        """
        name = 'Collection_Btree'
        keyList = []
        for i in range(4):                    # Create 5 key
            keyList.append(key + str(i))
    
        bkeyBASE = "bkey_byteArry"

        eflag = String("EFLAG").getBytes()
        filter = ElementFlagFilter(ElementFlagFilter.CompOperands.Equal, String("EFLAG").getBytes()) 
        attr = CollectionAttributes()
        attr.setExpireTime(ExpireTime)
        
        # BopInsert + byte_array bkey
        for j in range(4):                        # 5 Key 
            for i in range(50):                   # Insert 50 bkey
                bk = bkeyBASE + str(j) + str(i)   # Uniq bkey
                bkey = String(String.valueOf(bk)).getBytes()                        ####____####
                future = self.client.asyncBopInsert(keyList[j], bkey, eflag, random.choice(workloads), attr)
                result = self.arcusGet(future, name=name)
                #print str(result)

        # Bop Bulk Insert (Piped Insert)
        elements = []
        for i in range(50):
            bk = bkeyBASE + str(0) + str(i) + "bulk"
            elements.append(Element(String(str(bk)).getBytes(), workloads[0], eflag)) ####____####
        future = self.client.asyncBopPipedInsertBulk(keyList[0], elements, CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)
        
        # BopGet Range + filter
        for j in range(4):                    
            bk = bkeyBASE + str(j) + str(0)  
            bk_to = bkeyBASE + str(j) + str(50) 
            bkey = String(String.valueOf(bk)).getBytes()
            bkey_to = String(String.valueOf(bk_to)).getBytes()           ####____####
            future = self.client.asyncBopGet(keyList[j], bkey, bkey_to, filter, 0, random.randint(20, 50), False, False)
            result = self.arcusGet(future, name=name)
            #print str(result)
        
	# BopGetBulk  // 20120319 Ad
        bk = bkeyBASE + str(0) + str(0)                                                                                                                                      
        bk_to = bkeyBASE + str(4) + str(50)                                                                                                                                  
        bkey = String(String.valueOf(bk)).getBytes()                                                                                                                         
        bkey_to = String(String.valueOf(bk_to)).getBytes()           ####____####                                                                                            
        future = self.client.asyncBopGetBulk(keyList, bkey, bkey_to, filter, 0, random.randint(20, 50))                                                         
        result = self.arcusGet(future, name=name)
	#for entry in result.entrySet():
	#	print str(entry.getKey())

	#	if entry.getValue().getElements() is not None:
	#		print "["
	#		for element in entry.getValue().getElements().entrySet():
	#			print "bkey=%s, value=%s" % (str(element.getKey()), str(element.getValue().getValue()))
	#		print "]"
	#	else:
	#		print "[elements=%s, response=%s]" % (entry.getValue().getElements(), entry.getValue().getCollectionResponse().getMessage())
	#print ""
	#print str(result)
	
        # BopEmpty Create
        future = self.client.asyncBopCreate(key, ElementValueType.STRING, CollectionAttributes())
        result = self.arcusGet(future, name=name)
        #print str(result)

        # BopSMGet
        bk = bkeyBASE + str(0) + str(0)  
        bk_to = bkeyBASE + str(4) + str(50) 
        bkey = String(String.valueOf(bk)).getBytes()             ####____####
        bkey_to = String(String.valueOf(bk_to)).getBytes()       ####____####
        future = self.client.asyncBopSortMergeGet(keyList, bkey, bkey_to, filter, 0, random.randint(20, 50))
        result = self.arcusGet(future, name=name)
        #print str(result)
        
        # BopUpdate  (eflag bitOP + value)
        key = keyList[0]
        eflagOffset = 0
        value = "ThisIsChangeValue"
        bitop = ElementFlagUpdate(eflagOffset, ElementFlagFilter.BitWiseOperands.AND, String("aflag").getBytes())
        for i in range(2):                      # 3 element update
            bk = bkeyBASE + str(0) + str(i)
            bkey = String(String.valueOf(bk)).getBytes()       ####____####
            future = self.client.asyncBopUpdate(key, bkey, bitop, value)       
            result = self.arcusGet(future, name=name)
            #print str(result)
        
        # SetAttr  (change Expire Time)
        attr.setExpireTime(100)
        future = self.client.asyncSetAttr(key, attr)
        result = self.arcusGet(future, name=name)
        #print str(result)

        # BopDelete          (eflag filter delete)
        for j in range(4):                     
            bk = bkeyBASE + str(j) + str(0)  
            bk_to = bkeyBASE + str(j) + str(10) 
            bkey = String(String.valueOf(bk)).getBytes() ####____####
            bkey_to = String(String.valueOf(bk_to)).getBytes()  ####____####
            future = self.client.asyncBopDelete(keyList[j], bkey, bkey_to, filter, 0, False)
            result = self.arcusGet(future, name=name)