[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Start improve list-servers; refactor config types; less...
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv20799/lib/mixminion/server
Modified Files:
Modules.py ServerConfig.py
Log Message:
Start improve list-servers; refactor config types; less mem usage for flush.
ClientDirectory,ClientMain:
- New interface to display server information. Not done yet, but
better than groveling over directories by hand.
ClientMain, MMTPClient, ClientUtils:
- Change client queue flushing code so that we don't load everything
into memory when we flush the queue. Moved ClientQueue to use a
metadata store; added proxy class to lazy-load flushable messages
without changing sendMessages interface.
Config:
- Add resolveFeature/getFeature functions to generic config file
interface to make it easier for users to describe aspects of server
descriptors.
Config, ServerInfo, test, Modules, ServerConfig
- Change the way that types are specficied for _ConfigFile
derivitives: now they're by name instead of by by function. This
makes unparsing a snap, and keeps us from having to use private
(underscore-prefixed) names from Config.
Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Modules.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- Modules.py 13 Oct 2003 17:12:58 -0000 1.58
+++ Modules.py 7 Nov 2003 07:03:28 -0000 1.59
@@ -35,8 +35,7 @@
import mixminion.server.ServerConfig
import mixminion.server.EventStats as EventStats
import mixminion.server.PacketHandler
-from mixminion.Config import ConfigError, _parseBoolean, _parseCommand, \
- _parseInterval, _parseIntervalList, _parseSize
+from mixminion.Config import ConfigError
from mixminion.Common import LOG, MixError, ceilDiv, createPrivateDir, \
encodeBase64, isPrintingAscii, isSMTPMailbox, previousMidnight, \
readFile, waitForChildren
@@ -546,9 +545,9 @@
self.lock = threading.RLock()
def getConfigSyntax(self):
return { "Delivery/Fragmented" :
- { 'Enabled' : ('REQUIRE', _parseBoolean, "no"),
- 'MaximumSize' : ('REQUIRE', _parseSize, None),
- 'MaximumInterval' : ('ALLOW', _parseInterval, "2 days" )
+ { 'Enabled' : ('REQUIRE', "boolean", "no"),
+ 'MaximumSize' : ('REQUIRE', "size", None),
+ 'MaximumInterval' : ('ALLOW', "interval", "2 days" )
} }
def getRetrySchedule(self):
return [ ]
@@ -964,15 +963,15 @@
# FFFF There should be some way to say that fields are required
# FFFF if the module is enabled.
return { "Delivery/MBOX" :
- { 'Enabled' : ('REQUIRE', _parseBoolean, "no"),
- 'Retry': ('ALLOW', _parseIntervalList,
+ { 'Enabled' : ('REQUIRE', "boolean", "no"),
+ 'Retry': ('ALLOW', "intervalList",
"7 hours for 6 days"),
'AddressFile' : ('ALLOW', None, None),
'ReturnAddress' : ('ALLOW', None, None),
'RemoveContact' : ('ALLOW', None, None),
- 'AllowFromAddress' : ('ALLOW', _parseBoolean, 'yes'),
+ 'AllowFromAddress' : ('ALLOW', "boolean", 'yes'),
'SMTPServer' : ('ALLOW', None, 'localhost'),
- 'MaximumSize' : ('ALLOW', _parseSize, "100K"),
+ 'MaximumSize' : ('ALLOW', "size", "100K"),
}
}
@@ -1130,18 +1129,18 @@
def getConfigSyntax(self):
return { "Delivery/SMTP" :
- { 'Enabled' : ('REQUIRE', _parseBoolean, "no"),
- 'Retry': ('ALLOW', _parseIntervalList,
+ { 'Enabled' : ('REQUIRE', "boolean", "no"),
+ 'Retry': ('ALLOW', "intervalList",
"7 hours for 6 days"),
'BlacklistFile' : ('ALLOW', None, None),
'SMTPServer' : ('ALLOW', None, 'localhost'),
- 'AllowFromAddress': ('ALLOW', _parseBoolean, "yes"),
+ 'AllowFromAddress': ('ALLOW', "boolean", "yes"),
'Message' : ('ALLOW', None, ""),
'ReturnAddress': ('ALLOW', None, None), #Required on e
'FromTag' : ('ALLOW', None, "[Anon]"),
'SubjectLine' : ('ALLOW', None,
'Type III Anonymous Message'),
- 'MaximumSize' : ('ALLOW', _parseSize, "100K"),
+ 'MaximumSize' : ('ALLOW', "size", "100K"),
}
}
@@ -1239,16 +1238,16 @@
def getConfigSyntax(self):
return { "Delivery/SMTP-Via-Mixmaster" :
- { 'Enabled' : ('REQUIRE', _parseBoolean, "no"),
- 'Retry': ('ALLOW', _parseIntervalList,
+ { 'Enabled' : ('REQUIRE', "boolean", "no"),
+ 'Retry': ('ALLOW', "intervalList",
"7 hours for 6 days"),
- 'MixCommand' : ('REQUIRE', _parseCommand, None),
+ 'MixCommand' : ('REQUIRE', "command", None),
'Server' : ('REQUIRE', None, None),
'FromTag' : ('ALLOW', None, "[Anon]"),
'SubjectLine' : ('ALLOW', None,
'Type III Anonymous Message'),
- 'MaximumSize' : ('ALLOW', _parseSize, "100K"),
- 'AllowFromAddress' : ('ALLOW', _parseBoolean, "yes"),
+ 'MaximumSize' : ('ALLOW', "size", "100K"),
+ 'AllowFromAddress' : ('ALLOW', "boolean", "yes"),
}
}
Index: ServerConfig.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerConfig.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- ServerConfig.py 19 Oct 2003 03:12:02 -0000 1.38
+++ ServerConfig.py 7 Nov 2003 07:03:28 -0000 1.39
@@ -20,10 +20,12 @@
# moduleManager
#
_restrictFormat = 0
+
def __init__(self, fname=None, string=None, moduleManager=None):
# We use a copy of SERVER_SYNTAX, because the ModuleManager will
# mess it up.
self._syntax = SERVER_SYNTAX.copy()
+ self.CODING_FNS = CODING_FNS
if moduleManager is None:
self.moduleManager = mixminion.server.Modules.ModuleManager()
@@ -255,65 +257,69 @@
return ratio
# alias to make the syntax more terse.
-C = mixminion.Config
SERVER_SYNTAX = {
- 'Host' : C.ClientConfig._syntax['Host'],
+ 'Host' : mixminion.Config.ClientConfig._syntax['Host'],
'Server' : { '__SECTION__' : ('REQUIRE', None, None),
'Homedir' :
- ('ALLOW', C._parseFilename, "/var/spool/minion"),
+ ('ALLOW', "filename", "/var/spool/minion"),
'LogFile' : ('ALLOW', None, None),
- 'LogLevel' : ('ALLOW', C._parseSeverity, "WARN"),
- 'EchoMessages' : ('ALLOW', C._parseBoolean, "no"),
- 'Daemon' : ('ALLOW', C._parseBoolean, "no"),
- 'LogStats' : ('ALLOW', C._parseBoolean, 'yes'),
- 'StatsInterval' : ('ALLOW', C._parseInterval,
+ 'LogLevel' : ('ALLOW', "severity", "WARN"),
+ 'EchoMessages' : ('ALLOW', "boolean", "no"),
+ 'Daemon' : ('ALLOW', "boolean", "no"),
+ 'LogStats' : ('ALLOW', "boolean", 'yes'),
+ 'StatsInterval' : ('ALLOW', "interval",
"1 day"),
'StatsFile' : ('ALLOW', None, None),
- 'EncryptIdentityKey' :('ALLOW', C._parseBoolean, "no"),
- 'IdentityKeyBits': ('ALLOW', C._parseInt, "2048"),
- 'PublicKeyLifetime' : ('ALLOW', C._parseInterval,
+ 'EncryptIdentityKey' :('ALLOW', "boolean", "no"),
+ 'IdentityKeyBits': ('ALLOW', "int", "2048"),
+ 'PublicKeyLifetime' : ('ALLOW', "interval",
"30 days"),
- 'PublicKeyOverlap': ('ALLOW', C._parseInterval,
+ 'PublicKeyOverlap': ('ALLOW', "interval",
"24 hours"),
- 'EncryptPrivateKey' : ('ALLOW', C._parseBoolean, "no"),
- 'Mode' : ('REQUIRE', C._parseServerMode, "local"),
- 'Nickname': ('REQUIRE', C._parseNickname, None),
+ 'EncryptPrivateKey' : ('ALLOW', "boolean", "no"),
+ 'Mode' : ('REQUIRE', "serverMode", "local"),
+ 'Nickname': ('REQUIRE', "nickname", None),
'Contact-Email': ('ALLOW', None, None),
'Comments': ('ALLOW', None, None),
'ModulePath': ('ALLOW', None, None),
'Module': ('ALLOW*', None, None),
- 'MixAlgorithm' : ('ALLOW', _parseMixRule, "Timed"),
- 'MixInterval' : ('ALLOW', C._parseInterval, "30 min"),
- 'MixPoolRate' : ('ALLOW', _parseFraction, "60%"),
- 'MixPoolMinSize' : ('ALLOW', C._parseInt, "5"),
- 'Timeout' : ('ALLOW', C._parseInterval, "5 min"),
+ 'MixAlgorithm' : ('ALLOW', "mixRule", "Timed"),
+ 'MixInterval' : ('ALLOW', "interval", "30 min"),
+ 'MixPoolRate' : ('ALLOW', "fraction", "60%"),
+ 'MixPoolMinSize' : ('ALLOW', "int", "5"),
+ 'Timeout' : ('ALLOW', "interval", "5 min"),
#XXXX006 remove this.
- '__DEBUG_GC' : ('ALLOW', C._parseBoolean, "no"),
+ '__DEBUG_GC' : ('ALLOW', "boolean", "no"),
},
'DirectoryServers' : { # '__SECTION__' : ('REQUIRE', None, None),
'ServerURL' : ('ALLOW*', None, None),
'PublishURL' : ('ALLOW*', None, None),
- 'Publish' : ('ALLOW', C._parseBoolean, "no"),
- 'MaxSkew' : ('ALLOW', C._parseInterval,
+ 'Publish' : ('ALLOW', "boolean", "no"),
+ 'MaxSkew' : ('ALLOW', "interval",
"10 minutes",) },
# FFFF Generic multi-port listen/publish options.
- 'Incoming/MMTP' : { 'Enabled' : ('REQUIRE', C._parseBoolean, "no"),
+ 'Incoming/MMTP' : { 'Enabled' : ('REQUIRE', "boolean", "no"),
#XXXX007 deprecate or remove IP.
- 'IP' : ('ALLOW', C._parseIP, "0.0.0.0"),
- 'Hostname' : ('ALLOW', C._parseHost, None),
- 'Port' : ('ALLOW', C._parseInt, "48099"),
- 'ListenIP' : ('ALLOW', C._parseIP, None),
- 'ListenPort' : ('ALLOW', C._parseInt, None),
- 'ListenIP6' : ('ALLOW', C._parseIP6, None),
- 'Allow' : ('ALLOW*', C._parseAddressSet_allow, None),
- 'Deny' : ('ALLOW*', C._parseAddressSet_deny, None)
+ 'IP' : ('ALLOW', "IP", "0.0.0.0"),
+ 'Hostname' : ('ALLOW', "host", None),
+ 'Port' : ('ALLOW', "int", "48099"),
+ 'ListenIP' : ('ALLOW', "IP", None),
+ 'ListenPort' : ('ALLOW', "int", None),
+ 'ListenIP6' : ('ALLOW', "IP6", None),
+ 'Allow' : ('ALLOW*', "addressSet_allow", None),
+ 'Deny' : ('ALLOW*', "addressSet_deny", None)
},
- 'Outgoing/MMTP' : { 'Enabled' : ('REQUIRE', C._parseBoolean, "no"),
- 'Retry' : ('ALLOW', C._parseIntervalList,
+ 'Outgoing/MMTP' : { 'Enabled' : ('REQUIRE', "boolean", "no"),
+ 'Retry' : ('ALLOW', "intervalList",
"every 1 hour for 1 day, 7 hours for 5 days"),
- 'Allow' : ('ALLOW*', C._parseAddressSet_allow, None),
- 'Deny' : ('ALLOW*', C._parseAddressSet_deny, None) },
+ 'Allow' : ('ALLOW*', "addressSet_allow", None),
+ 'Deny' : ('ALLOW*', "addressSet_deny", None) },
# FFFF Missing: Queue-Size / Queue config options
# FFFF listen timeout??
}
+
+CODING_FNS = mixminion.Config._ConfigFile.CODING_FNS.copy()
+CODING_FNS.update({'mixRule':(_parseMixRule,str),
+ 'fraction':(_parseFraction,
+ lambda r: "%.2f%%"%(100.*r))})