SF.net SVN: fclient: [503] trunk/fcp2/src/fcp2/message.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-05 12:42:10
|
Revision: 503
http://fclient.svn.sourceforge.net/fclient/?rev=503&view=rev
Author: jUrner
Date: 2008-07-05 05:42:19 -0700 (Sat, 05 Jul 2008)
Log Message:
-----------
some more docs
beautification
some more message params
Modified Paths:
--------------
trunk/fcp2/src/fcp2/message.py
Modified: trunk/fcp2/src/fcp2/message.py
===================================================================
--- trunk/fcp2/src/fcp2/message.py 2008-07-05 12:03:40 UTC (rev 502)
+++ trunk/fcp2/src/fcp2/message.py 2008-07-05 12:42:19 UTC (rev 503)
@@ -179,12 +179,10 @@
pass
- #TODO:
- # 1. if one setter / getter fails no setter / getter result should assumed to be valid
- # 2. log errors
- #
- #
def _setPersistentParams(self, persistentData):
+ """updates message with persisten params
+ @param persistentData: (str)
+ """
params = persistentData.split(PersistentParamsSep)
if len(params) > len(self._persistent_params_):
raise ValueError('Too many parameters in persistentData')
@@ -195,6 +193,9 @@
def _getPersistentParams(self):
+ """retrieves persisten params from the message
+ @return: (str) persistent params
+ """
out = []
for n, (getter, setter) in enumerate(self._persistent_params_):
#TODO: check if PersistentParamsSep is in data returned
@@ -203,6 +204,10 @@
def _restoreParams(self, params):
+ """updates the message with mesasage params
+ @param params: (dict) containing message params
+ @note: the parameter values will be converted to python types in the call
+ """
for paramName, paramValue in params.items():
paramType = self._param_types_.get(paramName, None)
if paramType is not None:
@@ -212,6 +217,8 @@
def _getDataLength(self):
+ """returns the length of the data section attatched to the message
+ @return: (int) length"""
return 0
#********************************************************************************
@@ -549,8 +556,7 @@
_param_types_ = {
}
-#########################################
-#########################################
+
class MsgConfigData(_MessageBase):
name = consts.ConstMessage.ConfigData
_additional_params_ = {}
@@ -713,15 +719,13 @@
_param_types_ = {
}
-#####################################
-#####################################
+
class MsgModifyConfig(_MessageBase):
name = consts.ConstMessage.ModifyConfig
_additional_params_ = {}
_param_types_ = config._ConfigMessageParamTypes
-#####################################
-#####################################
+
class MsgModifyPeer(_MessageBase):
name = consts.ConstMessage.ModifyPeer
_additional_params_ = {}
@@ -744,8 +748,7 @@
'Global': types.TypeBool,
}
-###################################
-###################################
+
class MsgNodeData(_MessageBase):
name = consts.ConstMessage.NodeData
_additional_params_ = {}
@@ -870,8 +873,7 @@
'Testnet': types.TypeBool,
}
-#######################################
-#######################################
+
class MsgPeer(_MessageBase):
name = consts.ConstMessage.Peer
_additional_params_ = {}
@@ -892,8 +894,7 @@
_param_types_ = {
}
-#######################################
-#######################################
+
class MsgPersistentGet(_MessageBase):
name = consts.ConstMessage.PersistentGet
_additional_params_ = _AdditionalGetParams
@@ -910,8 +911,7 @@
return False
return True
-#######################################
-#######################################
+
class MsgPersistentPut(_MessageBase):
name = consts.ConstMessage.PersistentPut
_additional_params_ = _AdditionalPutParams
@@ -1006,15 +1006,14 @@
'URI': key.TypeKey,
}
-#####################################
-######################################
-#!! not implemented
-#TODO: has more params
+
class MsgPutSuccessful(_MessageBase):
name = consts.ConstMessage.PutSuccessful
_additional_params_ = {}
_param_types_ = {
+ 'CompletionTime': types.TypeTime,
'Global': types.TypeBool,
+ 'StartupTime': types.TypeTime,
'URI': key.TypeKey,
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|