Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

getVersion in Arakoon 2 python client

  • Loading branch information...
commit e39a28f4d3992a7de74a23191b1d9db1d851ab40 1 parent acbf4b0
Romain Slootmaekers authored
View
4 myocamlbuild.ml
@@ -54,8 +54,8 @@ let make_version _ _ =
try
Scanf.sscanf branch_version "* %i.%i.%i" (fun ma mi p -> (ma,mi,p))
with _ ->
- try Scanf.sscanf branch_version "* %i.%i" (fun ma mi -> (ma,mi,-1))
- with _ -> (-1,-1,-1)
+ try Scanf.sscanf branch_version "* %i.%i" (fun ma mi -> (ma,mi,999))
+ with _ -> (2,0,999)
in
Printf.sprintf template git_info time machine
major minor patch
View
8 pylabs/test/server/quick/system_tests_basic.py
@@ -217,12 +217,12 @@ def test_get_version():
#first on master:
vt = client.getVersion()
- logging.debug("tuple = %s", str(vt))
+ X.logging.debug("tuple = %s", str(vt))
(major,minor,patch, info) = vt
- assert_equals(major, 1)
+ assert_equals(major, 2)
#then on specific level:
- vt2 = client.getVersion(C.node_names[0])
- logging.debug("tuple = %s", str(vt2))
+ vt2 = client.getVersion(CONFIG.node_names[0])
+ X.logging.debug("tuple = %s", str(vt2))
client.dropConnections() # needed?
@C.with_custom_setup( C.default_setup, C.basic_teardown )
View
3  src/client/arakoon_remote_client.ml
@@ -112,9 +112,8 @@ object(self: #Arakoon_client.client)
let major = Pack.input_vint pack in
let minor = Pack.input_vint pack in
let patch = Pack.input_vint pack in
- let patch' = if patch > 20 then -1 else patch in (* TODO: fix *)
let info = Pack.input_string pack in
- (major,minor,patch', info)
+ (major,minor,patch, info)
)
end
View
19 src/client/python/Arakoon.py
@@ -465,6 +465,25 @@ def expectProgressPossible(self):
except ArakoonNoMaster:
return False
+ def getVersion(self, nodeId = None):
+ """
+ will return a tuple containing major, minor and patch level versions of the server side
+ @type nodeId : String
+ @param nodeId : id of the node you want to query (None if you want to query the master)
+ @rtype : (int,int,int,string)
+ @return : (major, minor, patch, info)
+ """
+ msg = ArakoonProtocol.encodeGetVersion()
+ conn = None
+ if nodeId is None:
+ conn = self._sendToMaster(msg)
+ else:
+ conn = self._sendMessage(nodeId, msg )
+
+ result = conn.decodeVersionResult()
+
+ return result
+
def statistics(self):
"""
View
4 src/client/python/ArakoonClientConnection.py
@@ -97,5 +97,7 @@ def decodeInt64Result(self):
def decodeNurseryCfgResult(self):
return ArakoonProtocol.decodeNurseryCfgResult(self)
-
+
+ def decodeVersionResult(self):
+ return ArakoonProtocol.decodeVersionResult(self)
View
32 src/client/python/ArakoonProtocol.py
@@ -228,7 +228,7 @@ def dump(src, length=8):
ARA_CMD_GET_NURSERY_CFG = 0x00000020 | ARA_CMD_MAG
ARA_CMD_REV_RAN_E = 0x00000023 | ARA_CMD_MAG
ARA_CMD_SYNCED_SEQUENCE = 0x00000024 | ARA_CMD_MAG
-
+ARA_CMD_VERSION = 0x00000028 | ARA_CMD_MAG
# Arakoon error codes
# Success
ARA_ERR_SUCCESS = 0
@@ -693,6 +693,19 @@ def encodeStatistics():
retVal = _packInt(ARA_CMD_STATISTICS)
return retVal
+ @staticmethod
+ def encodeGetVersion():
+ retVal = _packInt(ARA_CMD_VERSION)
+ return retVal
+
+ @staticmethod
+ def encodeGetKeyCount () :
+ return _packInt(ARA_CMD_KEY_COUNT)
+
+ @staticmethod
+ def encodeGetNurseryCfg ():
+ return _packInt(ARA_CMD_GET_NURSERY_CFG)
+
@staticmethod
def encodeUserFunction(name, argument):
retVal = _packInt(ARA_CMD_USER_FUNCTION)
@@ -749,6 +762,15 @@ def decodeStringResult ( con ):
input = ArakoonProtocol.readAnswer(con)
s = input.input_string()
return s
+
+ @staticmethod
+ def decodeVersionResult(con):
+ input = ArakoonProtocol.readAnswer(con)
+ major = input.input_vint()
+ minor = input.input_vint()
+ patch = input.input_vint()
+ info = input.input_string()
+ return (major,minor,patch,info)
@staticmethod
def decodeStringListResult( con ):
@@ -813,10 +835,4 @@ def decodeStatistics(con):
r = input.input_statistics()
return r
- @staticmethod
- def encodeGetKeyCount () :
- return _packInt(ARA_CMD_KEY_COUNT)
-
- @staticmethod
- def encodeGetNurseryCfg ():
- return _packInt(ARA_CMD_GET_NURSERY_CFG)
+
Please sign in to comment.
Something went wrong with that request. Please try again.