SF.net SVN: fclient: [303] trunk/sandbox/fcp2/consts.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <ju...@us...> - 2008-02-29 16:25:38
|
Revision: 303
http://fclient.svn.sourceforge.net/fclient/?rev=303&view=rev
Author: jurner
Date: 2008-02-29 08:25:42 -0800 (Fri, 29 Feb 2008)
Log Message:
-----------
added consts for time deltas and byte amounts
Modified Paths:
--------------
trunk/sandbox/fcp2/consts.py
Modified: trunk/sandbox/fcp2/consts.py
===================================================================
--- trunk/sandbox/fcp2/consts.py 2008-02-29 13:03:27 UTC (rev 302)
+++ trunk/sandbox/fcp2/consts.py 2008-02-29 16:25:42 UTC (rev 303)
@@ -35,6 +35,33 @@
FcpFalse = 'false'
+class ByteAmountPostfix:
+ Bytes = ''
+ Kilobytes = 'k'
+ Kibibytes = 'K'
+ Megabyres = 'm'
+ Mebibytes = 'K'
+ Gigabytes = 'g'
+ Gibibytes = 'G'
+ Petabytes = 'p'
+ Petibytes = 'P'
+ Exabytes = 'e'
+ Exibytes = 'E'
+
+ MembersAll = (
+ Bytes,
+ Kilobytes,
+ Kibibytes,
+ Megabyres,
+ Mebibytes,
+ Gigabytes,
+ Gibibytes,
+ Petabytes,
+ Petibytes,
+ Exabytes,
+ Exibytes,
+ )
+
class ConfigDataType:
"""Basic data types in config messages"""
Boolean = 'boolean'
@@ -144,55 +171,6 @@
Canceled = 10
-class ProtocolError(Exception):
- """All protocol errors supported by the client"""
-
- def __init__(self, msg):
- """
- @param msg: (Message) ProtocolError message or its parameters dict
- """
- self.value = '%s (%s, %s)' % (
- msg.get('CodeDescription', 'Unknown error') ,
- msg['Code'],
- msg.get('ExtraDescription', '???'),
- )
- def __str__(self): return self.value
-
- ClientHelloMustBeFirst = 1
- NoLateClientHellos = 2
- MessageParseError = 3
- UriParseError = 4
- MissingField = 5
- ErrorParsingNumber = 6
- InvalidMessage = 7
- InvalidField = 8
- FileNotFound = 9
- DiskTargetExists = 10 # handled:
- SameDirectoryExpected = 11
- CouldNotCreateFile = 12
- CouldNotWriteFile = 13
- CouldNotRenameFile = 14
- NoSuchIdentifier = 15
- NotSupported = 16
- InternalError = 17
- ShuttingDown = 18 # handled:
- NoSuchNodeIdentifier = 19 # Unused since 995
- UrlParseError = 20
- ReferenceParseError = 21
- FileParseError = 22
- NotAFile = 23
- AccessDenied = 24
- DDADenied = 25 # handled:
- CouldNotReadFile = 26
- ReferenceSignature = 27
- CanNotPeerWithSelf = 28
- PeerExists = 29
- OpennetDisabled = 30
- DarknetPeerOnly = 31
- NoSuchPlugin = 32
-
-# others
-
class ConnectReason:
"""Reason for connecting to the node
@cvar Connect: reason is a regualr connect
@@ -369,6 +347,54 @@
ClientDisconnected = 'FcClientDisconnected'
+class ProtocolError(Exception):
+ """All protocol errors supported by the client"""
+
+ def __init__(self, msg):
+ """
+ @param msg: (Message) ProtocolError message or its parameters dict
+ """
+ self.value = '%s (%s, %s)' % (
+ msg.get('CodeDescription', 'Unknown error') ,
+ msg['Code'],
+ msg.get('ExtraDescription', '???'),
+ )
+ def __str__(self): return self.value
+
+ ClientHelloMustBeFirst = 1
+ NoLateClientHellos = 2
+ MessageParseError = 3
+ UriParseError = 4
+ MissingField = 5
+ ErrorParsingNumber = 6
+ InvalidMessage = 7
+ InvalidField = 8
+ FileNotFound = 9
+ DiskTargetExists = 10 # handled:
+ SameDirectoryExpected = 11
+ CouldNotCreateFile = 12
+ CouldNotWriteFile = 13
+ CouldNotRenameFile = 14
+ NoSuchIdentifier = 15
+ NotSupported = 16
+ InternalError = 17
+ ShuttingDown = 18 # handled:
+ NoSuchNodeIdentifier = 19 # Unused since 995
+ UrlParseError = 20
+ ReferenceParseError = 21
+ FileParseError = 22
+ NotAFile = 23
+ AccessDenied = 24
+ DDADenied = 25 # handled:
+ CouldNotReadFile = 26
+ ReferenceSignature = 27
+ CanNotPeerWithSelf = 28
+ PeerExists = 29
+ OpennetDisabled = 30
+ DarknetPeerOnly = 31
+ NoSuchPlugin = 32
+
+
class RequestStatus(BaseBitFlags):
"""Request status flags
@cvar Null: no status
@@ -416,6 +442,25 @@
Unknown = 'UNKNOWN STATUS'
+class PeerNoteType:
+ """All known peer note types"""
+ Private = '1'
+
+
+class Persistence:
+ Connection = 'connection'
+ Reboot = 'reboot'
+ Forever = 'forever'
+
+
+class Priority:
+ Highest = '0'
+ Higher = '1'
+ High = '2'
+ Medium = '3'
+ Low = '4'
+
+
class RequestType(BaseBitFlags):
"""Consts indicating the type of a request"""
@@ -443,25 +488,6 @@
MaskPut = PutData | PutFile | PutDir | PutMultiple | PutRedirect
-class PeerNoteType:
- """All known peer note types"""
- Private = '1'
-
-
-class Persistence:
- Connection = 'connection'
- Reboot = 'reboot'
- Forever = 'forever'
-
-
-class Priority:
- Highest = '0'
- Higher = '1'
- High = '2'
- Medium = '3'
- Low = '4'
-
-
class RequestModified(BaseBitFlags):
"""Flags indicating what aspect of a request has been modified
@cvar Filename: the filename has been modified
@@ -485,6 +511,24 @@
Nothing = 'none'
+class TimeDeltaPostfix:
+ Second = ''
+ Minute = 'minute'
+ Hour = 'hour'
+ Day = 'day'
+ Month = 'month'
+ Year = 'year'
+
+ MembersAll = (
+ Second,
+ Minute,
+ Hour,
+ Day,
+ Month,
+ Year,
+ )
+
+
class UploadFrom:
Direct = 'direct'
Disk = 'disk'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|