Ejemplo n.º 1
0
Archivo: dbm.py Proyecto: Amit-DU/dht
 def inject (self):
     arg = dhashgateway_prot.dhash_retrieve_arg ()
     blk = make_block (data_size)
     sobj = sha.sha(blk)
     arg.blockID = bigint(sobj.digest())
     arg.ctype   = dhash_types.DHASH_CONTENTHASH
     arg.options = 0
     arg.guess   = bigint(0)
     
     start = time.time()
     try:
         self.outstanding += 1
         res = self.client (dhashgateway_prot.DHASHPROC_RETRIEVE, arg,
                            lambda x: self.process(start, arg, blk, x))
         if res is not None:
             self.process (start, arg, res)
     except RPC.UnpackException, e:
         print_exc ()
Ejemplo n.º 2
0
    def inject(self):
        arg = dhashgateway_prot.dhash_retrieve_arg()
        blk = make_block(data_size)
        sobj = sha.sha(blk)
        arg.blockID = bigint(sobj.digest())
        arg.ctype = dhash_types.DHASH_CONTENTHASH
        arg.options = 0
        arg.guess = bigint(0)

        start = time.time()
        try:
            self.outstanding += 1
            res = self.client(dhashgateway_prot.DHASHPROC_RETRIEVE, arg,
                              lambda x: self.process(start, arg, blk, x))
            if res is not None:
                self.process(start, arg, res)
        except RPC.UnpackException, e:
            print_exc()
Ejemplo n.º 3
0
Archivo: dbm.py Proyecto: Amit-DU/dht
 def inject (self):
     arg = dhashgateway_prot.dhash_insert_arg ()
     
     arg.block   = make_block (data_size)
     sobj = sha.sha(arg.block)
     arg.blockID = bigint(sobj.digest())
     print "Inserting", arg.blockID
     arg.ctype   = dhash_types.DHASH_CONTENTHASH
     arg.len     = data_size
     arg.options = 0
     arg.guess   = bigint(0)
     
     start = time.time()
     try:
         self.outstanding += 1
         res = self.client (dhashgateway_prot.DHASHPROC_INSERT, arg,
                            lambda x: self.process(start, arg, x))
         if res is not None:
             self.process (start, arg, res)
     except RPC.UnpackException, e:
         print_exc ()
Ejemplo n.º 4
0
    def inject(self):
        arg = dhashgateway_prot.dhash_insert_arg()

        arg.block = make_block(data_size)
        sobj = sha.sha(arg.block)
        arg.blockID = bigint(sobj.digest())
        print "Inserting", arg.blockID
        arg.ctype = dhash_types.DHASH_CONTENTHASH
        arg.len = data_size
        arg.options = 0
        arg.guess = bigint(0)

        start = time.time()
        try:
            self.outstanding += 1
            res = self.client(dhashgateway_prot.DHASHPROC_INSERT, arg,
                              lambda x: self.process(start, arg, x))
            if res is not None:
                self.process(start, arg, res)
        except RPC.UnpackException, e:
            print_exc()
Ejemplo n.º 5
0
    def inject (self):

        arg = dhashgateway_prot.dhash_retrieve_arg ()

	#specify the content hash key corresponding to the block to be retrieved
        arg.blockID = self.key 
        arg.ctype   = dhash_types.DHASH_CONTENTHASH

        arg.options = 0
        arg.guess   = bigint(0)
        
        start = time.time()
        try:
	    # invokes dhash gateway to fetch the block
	    # when the block is fetched, self.process() will be invoked
            res = self.client (dhashgateway_prot.DHASHPROC_RETRIEVE, arg,
                               lambda x: self.process(start, arg, x))
            if res is not None:
                self.process (start, arg, res)
        except RPC.UnpackException, e:
            print_exc ()
Ejemplo n.º 6
0
    def inject(self):

        arg = dhashgateway_prot.dhash_retrieve_arg()

        #specify the content hash key corresponding to the block to be retrieved
        arg.blockID = self.key
        arg.ctype = dhash_types.DHASH_CONTENTHASH

        arg.options = 0
        arg.guess = bigint(0)

        start = time.time()
        try:
            # invokes dhash gateway to fetch the block
            # when the block is fetched, self.process() will be invoked
            res = self.client(dhashgateway_prot.DHASHPROC_RETRIEVE, arg,
                              lambda x: self.process(start, arg, x))
            if res is not None:
                self.process(start, arg, res)
        except RPC.UnpackException, e:
            print_exc()