Beispiel #1
0
 def unregisterClient(self, clientID):
     if self._isValidClientID(clientID):
         self.pdManagers[clientID].cleanOutDeferreds()
         del self.pdManagers[clientID]
     else:
         raise error.InvalidClientID(
             "Client with ID %i has not been registered." % clientID)
Beispiel #2
0
 def getPendingDeferred(self, clientID, deferredID, block):
     if self._isValidClientID(clientID):
         return self.pdManagers[clientID].getPendingDeferred(
             deferredID, block)
     else:
         return defer.fail(
             failure.Failure(
                 error.InvalidClientID(
                     "Client with ID %i has not been registered." %
                     clientID)))
Beispiel #3
0
 def flush(self, clientID):
     if clientID == 'all':
         for pdm in self.pdManagers.values():
             pdm.cleanOutDeferreds()
     else:
         if self._isValidClientID(clientID):
             self.pdManagers[clientID].cleanOutDeferreds()
             return defer.succeed(None)
         else:
             return defer.fail(
                 failure.Failure(
                     error.InvalidClientID(
                         "Client with ID %i has not been registered." %
                         clientID)))
Beispiel #4
0
 def wrapperTwoPhase(pendingDeferredAdapter, *args, **kwargs):
     clientID = args[0]
     block = args[1]
     if pendingDeferredAdapter._isValidClientID(clientID):
         if block:
             return wrappedMethod(pendingDeferredAdapter, *args[2:],
                                  **kwargs)
         else:
             deferredID = pendingDeferredAdapter.getNextPendingDeferredID(
                 clientID)
             d = wrappedMethod(pendingDeferredAdapter, *args[2:], **kwargs)
             pendingDeferredAdapter.savePendingDeferred(
                 clientID, deferredID, d)
             return defer.succeed(deferredID)
     else:
         return defer.fail(
             failure.Failure(
                 error.InvalidClientID(
                     "Client with ID %r has not been registered." %
                     clientID)))