示例#1
0
 def PutKey( self, rsaKey, data, updateLevel ) :
     self._initCount()
     signature = computeSignature( rsaKey, data, updateLevel )
     self.client.callPutKey( rsaKey.toDER_PublicKey(), data,
             updateLevel, signature, self.nodeAddr,
             self._onResult )
     self.reactor.run()
示例#2
0
 def onResult(nodes):
     obj.nodes = nodes
     obj.successCount = 0
     obj.putOps = {}
     obj.updateLevel = updateLevel + 1
     obj.signature = computeSignature(rsaKey, data, obj.updateLevel)
     for nodeAddr in obj.nodes:
         doPutKey(nodeAddr)
     op.setCanceler(cancelPuts)
     if not obj.putOps:
         doNotify()
示例#3
0
文件: client.py 项目: hj91/cspace
 def onResult( nodes ) :
     obj.nodes = nodes
     obj.successCount = 0
     obj.putOps = {}
     obj.updateLevel = updateLevel + 1
     obj.signature = computeSignature( rsaKey, data,
         obj.updateLevel )
     for nodeAddr in obj.nodes :
         doPutKey( nodeAddr )
     op.setCanceler( cancelPuts )
     if not obj.putOps :
         doNotify()
示例#4
0
 def onPut(putOp, err, payload):
     del obj.putOps[putOp]
     if err >= 0:
         result, oldData, oldUpdateLevel, oldSignature = payload
         if result >= 0:
             obj.successCount += 1
         elif oldUpdateLevel >= obj.updateLevel:
             if verifySignature(rsaKey, oldData, oldUpdateLevel, oldSignature):
                 obj.updateLevel = oldUpdateLevel + 1
                 cancelPuts()
                 obj.putOps.clear()
                 obj.successCount = 0
                 obj.signature = computeSignature(rsaKey, data, obj.updateLevel)
                 for nodeAddr in obj.nodes:
                     doPutKey(nodeAddr)
     if not obj.putOps:
         doNotify()
示例#5
0
文件: client.py 项目: hj91/cspace
 def onPut( putOp, err, payload ) :
     del obj.putOps[putOp]
     if err >= 0 :
         result,oldData,oldUpdateLevel,oldSignature = payload
         if result >= 0 :
             obj.successCount += 1
         elif oldUpdateLevel >= obj.updateLevel :
             if verifySignature(rsaKey,oldData,
                     oldUpdateLevel,oldSignature) :
                 obj.updateLevel = oldUpdateLevel + 1
                 cancelPuts()
                 obj.putOps.clear()
                 obj.successCount = 0
                 obj.signature = computeSignature( rsaKey, data,
                         obj.updateLevel )
                 for nodeAddr in obj.nodes :
                     doPutKey( nodeAddr )
     if not obj.putOps :
         doNotify()
示例#6
0
 def PutKey(self, rsaKey, data, updateLevel):
     self._initCount()
     signature = computeSignature(rsaKey, data, updateLevel)
     self.client.callPutKey(rsaKey.toDER_PublicKey(), data, updateLevel,
                            signature, self.nodeAddr, self._onResult)
     self.reactor.run()