[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Deprecate, document, and extend. Implement faster shut...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv25437/minion/lib/mixminion

Modified Files:
	ClientMain.py Common.py Main.py 
Log Message:
Deprecate, document, and extend.  Implement faster shutdown.

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- ClientMain.py	6 Jun 2003 06:08:39 -0000	1.91
+++ ClientMain.py	26 Jun 2003 03:23:53 -0000	1.92
@@ -1348,10 +1348,6 @@
 
         # Initialize PRNG
         self.prng = mixminion.Crypto.getCommonPRNG()
-        # XXXX005 remove.
-        if os.path.exists(os.path.join(userdir, "pool")):
-            os.rename(os.path.join(userdir, "pool"),
-                      os.path.join(userdir, "queue"))
         self.queue = ClientQueue(os.path.join(userdir, "queue"))
 
     def sendForwardMessage(self, address, payload, servers1, servers2,
@@ -1869,8 +1865,6 @@
             elif o in ('-R', '--reply-block'):
                 assert wantForwardPath
                 self.replyBlockFiles.append(v)
-            elif o == '--swap-at':
-                raise UIError("--swap-at is no longer necessary.")
             elif o in ('-H', '--hops'):
                 assert wantForwardPath or wantReplyPath
                 if self.nHops is not None:
@@ -1894,14 +1888,6 @@
                     self.lifetime = int(v)
                 except ValueError:
                     raise UsageError("%s expects an integer"%o)
-            elif o in ('--pool',):
-                LOG.warn(
-                    "The --pool option is deprecated; use --queue instead")
-                self.forceQueue = 1
-            elif o in ('--no-pool',):
-                LOG.warn(
-                 "The --no-pool option is deprecated; use --no-queue instead")
-                self.forceNoQueue = 1
             elif o in ('--queue',):
                 self.forceQueue = 1
             elif o in ('--no-queue',):
@@ -2109,14 +2095,14 @@
         print >>sys.stderr, "ERROR: %s"%error
         print >>sys.stderr, "For usage, run 'mixminion send --help'"
         sys.exit(1)
-    if cmd.endswith(" pool") or cmd.endswith(" queue"):
-        print _SEND_USAGE % { 'cmd' : cmd, 'send' : 'pool', 'Send': 'Pool',
+    if cmd.endswith(" queue"):
+        print _SEND_USAGE % { 'cmd' : cmd, 'send' : 'queue', 'Send': 'Queue',
                               'extra' : '' }
     else:
         print _SEND_USAGE % { 'cmd' : cmd, 'send' : 'send', 'Send': 'Send',
                               'extra' : """\
-  --queue                    Pool the message; don't send it.
-  --no-queue                 Do not attempt to pool the message.""" }
+  --queue                    Queue the message; don't send it.
+  --no-queue                 Do not attempt to queue the message.""" }
     sys.exit(0)
 
 def runClient(cmd, args):
@@ -2127,17 +2113,13 @@
     queueMode = 0
     if cmd.endswith(" queue"):
         queueMode = 1
-    elif cmd.endswith(" pool"):
-        LOG.warn("The 'pool' command is deprecated.  Use 'queue' instead.")
-        queueMode = 1
 
     ###
     # Parse and validate our options.
-    #XXXX005 remove obsolete swap-at option.
     options, args = getopt.getopt(args, "hvf:D:t:H:P:R:i:",
              ["help", "verbose", "config=", "download-directory=",
-              "to=", "hops=", "swap-at=", "path=", "reply-block=",
-              "input=", "pool", "no-pool", "queue", "no-queue" ])
+              "to=", "hops=", "path=", "reply-block=",
+              "input=", "queue", "no-queue" ])
 
     if not options:
         sendUsageAndExit(cmd)
@@ -2677,9 +2659,6 @@
         e.dump()
         print _LIST_QUEUE_USAGE % { 'cmd' : cmd }
         sys.exit(1)
-
-    if cmd.endswith("pool"):
-        LOG.warn("'inspect-pool' is deprecated; use inspect-queue instead")
 
     parser.init()
     client = parser.client

Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- Common.py	25 Jun 2003 17:03:10 -0000	1.91
+++ Common.py	26 Jun 2003 03:23:53 -0000	1.92
@@ -1319,18 +1319,24 @@
 # Threading operations
 
 class ClearableQueue(MessageQueue):
-    """DOCDOC"""
+    """Extended version of python's Queue class that supports removing
+       all the items from the queue."""
     #XXXX005 testme
     def clear(self):
+        """Remove all the items from this queue."""
+
+        # If the queue is empty, return.
         if not self.esema.acquire(0):
             return
         self.mutex.acquire()
         was_full = self._full()
         self._clear()
         assert self._empty()
+        # If the queue used to be full, it isn't anymore.
         if was_full:
             self.fsema.release()
         self.mutex.release()
 
     def _clear(self):
+        """Backend for _clear"""
         del self.queue[:]

Index: Main.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Main.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- Main.py	21 Jun 2003 07:24:07 -0000	1.50
+++ Main.py	26 Jun 2003 03:23:53 -0000	1.51
@@ -126,7 +126,7 @@
     "inspect-surb" :   ( 'mixminion.ClientMain', 'inspectSURBs' ),
     "inspect-surbs" :  ( 'mixminion.ClientMain', 'inspectSURBs' ),
     "flush" :          ( 'mixminion.ClientMain', 'flushQueue' ),
-    "inspect-queue" :   ( 'mixminion.ClientMain', 'listQueue' ),
+    "inspect-queue" :  ( 'mixminion.ClientMain', 'listQueue' ),
     "ping" :           ( 'mixminion.ClientMain', 'runPing' ),
     "server-start" :   ( 'mixminion.server.ServerMain', 'runServer' ),
     "server-stop" :    ( 'mixminion.server.ServerMain', 'signalServer' ),