Thread: SF.net SVN: fclient: [457] trunk/fcp2/src/fcp2/consts.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-01 11:27:04
|
Revision: 457
http://fclient.svn.sourceforge.net/fclient/?rev=457&view=rev
Author: jUrner
Date: 2008-07-01 04:27:11 -0700 (Tue, 01 Jul 2008)
Log Message:
-----------
for ease of use, all necessary symbols are now imported to main
Modified Paths:
--------------
trunk/fcp2/src/fcp2/consts.py
Modified: trunk/fcp2/src/fcp2/consts.py
===================================================================
--- trunk/fcp2/src/fcp2/consts.py 2008-07-01 11:27:03 UTC (rev 456)
+++ trunk/fcp2/src/fcp2/consts.py 2008-07-01 11:27:11 UTC (rev 457)
@@ -7,7 +7,7 @@
#*****************************************************************************
# exceptions
#*****************************************************************************
-class FcpError(Exception):
+class Error(Exception):
def __init__(self, message, logMethod=None, logLevel=None):
if logMethod is not None:
if logLevel is None:
@@ -16,25 +16,25 @@
logMethod(logLevel, self.__class__.__name__ + ': %s' % message)
Exception.__init__(self, message)
-class MessageParseError(FcpError):
+class ErrorMessageParse(Error):
"""Exception raised when a message could not be parsed succesfuly"""
-class IOConnectFailedError(FcpError):
+class ErrorIOConnectFailed(Error):
"""Exception raised if the object can not be connected"""
-class IOClosedError(FcpError):
+class ErrorIOClosed(Error):
"""Exception raised if the object is closed"""
-class IOBrokenError(FcpError):
+class ErrorIOBroken(Error):
"""Exception raised if the IO connection is broken"""
-class IOTimeoutError(Exception):
+class ErrorIOTimeout(Error):
"""Exception raised when the io connection is closed"""
#************************************************************************
#
#************************************************************************
-class BaseBitFlags(object):
+class _BaseBitFlags(object):
"""Base class for classes containing bitflags (bitflags only that is)"""
@classmethod
@@ -58,12 +58,11 @@
#************************************************************************
#
#************************************************************************
-ConfigKeySep = '.'
FcpTrue = 'true'
FcpFalse = 'false'
-class ByteAmountPostfix:
+class ConstByteAmountPostfix:
Bytes = ''
Kilobytes = 'k'
Kibibytes = 'K'
@@ -90,46 +89,8 @@
Exibytes,
)
-class ConfigDataType:
- """Basic data types in config messages"""
- Boolean = 'boolean'
- Number = 'number'
- String = 'string'
- StringArray = 'atringArray'
-
- TypesAll = (
- Boolean,
- Number,
- String,
- StringArray,
- )
-
-class ConfigValueClass:
- """Value classes Fcp passes in config messages"""
-
- Current = 'current'
- Default = 'default'
- ExpertFlag = 'expertFlag'
- ForceWriteFlag = 'forceWriteFlag'
- ShortDescription = 'shortDescription'
- LongDescription = 'longDescription'
- SortOrder = 'sortOrder'
- DataType = 'dataType'
-
- ClassesAll = (
- Current,
- Default,
- ExpertFlag,
- ForceWriteFlag,
- ShortDescription,
- LongDescription,
- SortOrder,
- DataType,
- )
-
-
-class ConnectReason:
+class ConstConnectReason:
"""Reason for connecting to the node
@cvar Connect: reason is a regualr connect
@cvar Reconnect: reason is a reconnect
@@ -137,8 +98,7 @@
Connect = 1
Reconnect = 2
-
-class DebugVerbosity:
+class ConstDebugVerbosity:
"""Consts indicating the verbosity level for debugging"""
Chatty = logging.DEBUG - 1
Debug = logging.DEBUG
@@ -147,9 +107,8 @@
Error = logging.ERROR
Critical = logging.CRITICAL
Quiet = 1000000
-
-class DisconnectReason(BaseBitFlags):
+class ConstDisconnectReason(_BaseBitFlags):
"""Reasons for client disconnect
@cvar Close: the clent is about to close down
@cvar ConnectionDied: the connection died unexpectedly
@@ -171,8 +130,7 @@
UnknownNodeHello = 7
VersionMissmatch = 8
-
-class FetchError(Exception):
+class ConstFetchError(Exception):
"""All fetch errors supported by the client"""
def __init__(self, msg):
@@ -215,8 +173,7 @@
PermanentRedirect = 27
NotAllDataFound = 28
-
-class FilenameCollision(BaseBitFlags):
+class ConstFilenameCollision(_BaseBitFlags):
"""Filename collision flags
@cvar HandleNever: don't handle filename collisions
@cvar HandleRename: rename file on collisions
@@ -230,8 +187,7 @@
CollisionHandled = 0x10000000 # a filename collision has already been handled
-
-class InsertError(Exception):
+class ConstInsertError(Exception):
"""All insert errors supported by the client"""
def __init__(self, msg):
@@ -256,8 +212,7 @@
Collision = 9
Canceled = 10
-
-class KeyType:
+class ConstKeyType:
"""Supported key types"""
SSK = 'SSK@'
KSK = 'KSK@'
@@ -266,9 +221,8 @@
SVK = 'SVK@'
Invalid = ''
TypesAll = (SSK, KSK, CHK, USK, SVK)
-
-class Logger:
+class ConstLogger:
"""Package loggers"""
Fcp = logging.getLogger('Fcp')
Client = logging.getLogger('Fcp.Client')
@@ -277,13 +231,11 @@
IOHandler =logging.getLogger('Fcp.Client.IOHandler')
IO =logging.getLogger('Fcp.Client.IOHandler.IO')
Message = logging.getLogger('Fcp.Client.Message')
-logging.addLevelName(DebugVerbosity.Chatty, 'chatty')
-logging.addLevelName(DebugVerbosity.Quiet, 'quiet')
+logging.addLevelName(ConstDebugVerbosity.Chatty, 'chatty')
+logging.addLevelName(ConstDebugVerbosity.Quiet, 'quiet')
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
-
-
-class LogMessages:
+class ConstLogMessages:
"""Strings used for log infos"""
Connecting = 'connecting'
@@ -308,9 +260,7 @@
InvalidPersistentParams = 'Invalid peristent params'
-
-
-class Message:
+class ConstMessage:
"""Fcp messages"""
# client --> node
@@ -383,9 +333,8 @@
ClientSocketTimeout = 'FcSocketTimeout'
ClientSocketDied = 'FcSocketDied'
ClientDisconnected = 'FcClientDisconnected'
-
-class PeerNodeStatus:
+class ConstPeerNodeStatus:
Connected = 'CONNECTED'
BackedOff = 'BACKED OFF'
TooNew = 'TOO NEW'
@@ -401,19 +350,17 @@
Bursting = 'BURSTING'
Disconnecting = 'DISCONNECTING'
Unknown = 'UNKNOWN STATUS'
-
-class PeerNoteType:
+class ConstPeerNoteType:
"""All known peer note types"""
Private = '1'
-
-class Persistence:
+class ConstPersistence:
Connection = 'connection'
Reboot = 'reboot'
Forever = 'forever'
-class Priority:
+class ConstPriority:
Highest = '0'
Higher = '1'
High = '2'
@@ -422,8 +369,7 @@
Lower = '5'
Lowest = '6'
-
-class ProtocolError(Exception):
+class ConstProtocolError(Exception):
"""All protocol errors supported by the client"""
def __init__(self, msg):
@@ -470,13 +416,11 @@
DarknetPeerOnly = 31
NoSuchPlugin = 32
-
-class PutDirType:
+class ConstPutDirType:
Complex = 'complex'
Disk = 'disk'
-
-class RequestModified(BaseBitFlags):
+class ConstRequestModified(_BaseBitFlags):
"""Flags indicating what aspect of a request has been modified
@cvar Filename: the filename has been modified
@cvar Identifier: the identifier has been moodified
@@ -492,8 +436,7 @@
PersistentUserData = 0x1
PriorityClass = 0x2
-
-class RequestStatus(BaseBitFlags):
+class ConstRequestStatus(_BaseBitFlags):
"""Request status flags
@cvar Null: no status
@cvar Restored: the request was restored when the client was started
@@ -520,9 +463,8 @@
Completed =0x10000000
RemovedFromQueue = 0x2000000
-
-class RequestType(BaseBitFlags):
+class ConstRequestType(_BaseBitFlags):
"""Consts indicating the type of a request"""
Null = 0
@@ -548,14 +490,12 @@
MaskPlugin = PluginInfo | PluginMessage
MaskPut = PutData | PutFile | PutDir | PutMultiple | PutRedirect
-
-class ReturnType:
+class ConstReturnType:
Direct = 'direct'
Disk = 'disk'
Nothing = 'none'
-
-class TimeDeltaPostfix:
+class ConstTimeDeltaPostfix:
Second = ''
Minute = 'minute'
Hour = 'hour'
@@ -571,16 +511,16 @@
Month,
Year,
)
-
-class UploadFrom:
+class ConstUploadFrom:
Direct = 'direct'
Disk = 'disk'
Redirect = 'redirect'
-
-class Verbosity(BaseBitFlags):
+class ConstVerbosity(_BaseBitFlags):
ReportCompletion = 0x0
ReportProgress = 0x1
ReportCompression = 0x200
-
+
+
+__all__ = [i for i in dir() if i[0].isupper() and not i.startswith('_')]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-04 08:27:41
|
Revision: 492
http://fclient.svn.sourceforge.net/fclient/?rev=492&view=rev
Author: jUrner
Date: 2008-07-04 01:27:51 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
new message
Modified Paths:
--------------
trunk/fcp2/src/fcp2/consts.py
Modified: trunk/fcp2/src/fcp2/consts.py
===================================================================
--- trunk/fcp2/src/fcp2/consts.py 2008-07-04 08:27:35 UTC (rev 491)
+++ trunk/fcp2/src/fcp2/consts.py 2008-07-04 08:27:51 UTC (rev 492)
@@ -322,6 +322,7 @@
SimpleProgress = 'SimpleProgress'
SSKKeypair = 'SSKKeypair'
StartedCompression = 'StartedCompression'
+ SubscribedUSK = 'SubscribedUSK'
SubscribedUSKUpdate = 'SubscribedUSKUpdate'
TestDDAComplete = 'TestDDAComplete' # (since 1027)
TestDDAReply = 'TestDDAReply' # (since 1027)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-05 21:29:31
|
Revision: 508
http://fclient.svn.sourceforge.net/fclient/?rev=508&view=rev
Author: jUrner
Date: 2008-07-05 14:29:41 -0700 (Sat, 05 Jul 2008)
Log Message:
-----------
added a few notes
Modified Paths:
--------------
trunk/fcp2/src/fcp2/consts.py
Modified: trunk/fcp2/src/fcp2/consts.py
===================================================================
--- trunk/fcp2/src/fcp2/consts.py 2008-07-05 21:20:24 UTC (rev 507)
+++ trunk/fcp2/src/fcp2/consts.py 2008-07-05 21:29:41 UTC (rev 508)
@@ -154,7 +154,7 @@
MaxArchiveRestartsExceeded = 8
MaxRecursionLevelExceeded = 9
NotAnArchve = 10
- TooManyMetastrings = 11
+ TooManyMetastrings = 11 # too many components in key. try remove 1. for example a trailing slash
BucketError = 12
DataNotFound = 13
RouteNotFound = 14
@@ -167,10 +167,10 @@
TooBig = 21
MetadataTooBig = 22
TooManyBlocks = 23
- NotEnoughMetastrings = 24
+ NotEnoughMetastrings = 24 # not enoughcomponents in key. try adding 1. for example a trailing slash
Canceled = 25
ArchiveRestart = 26
- PermanentRedirect = 27
+ PermanentRedirect = 27 # 'USK@.../-1/' for example will always fail and return a key pointing to the current edition
NotAllDataFound = 28
class ConstFilenameCollision(_BaseBitFlags):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|