Commit 4b4af59b authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

Added GetVersion

parent 89a1dda4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2,6 +2,13 @@ Changes since 0.7.0
===================
This section will document changes to the library since the last release

## New features
- Added getVersion and getVersionAsync to the library.

## Bug Fixes
- Lowered default number of keys asked on ranges to 200 (ASKOVAD-287)
- Fixed typo on baset test case (Merge #2, contributed by @zaitcev)

Changes from 0.6.0.2 to 0.7.0
=============================

+5 −0
Original line number Diff line number Diff line
@@ -177,7 +177,12 @@ class BaseAsync(Client):
    def getKeyRangeAsync(self, onSuccess, onError, *args, **kwargs):
        return self._processAsync(operations.GetKeyRange, onSuccess, onError, *args, **kwargs)

    def getVersionAsync(self, onSuccess, onError, *args, **kwargs):
        return self._processAsync(operations.GetVersion, onSuccess, onError, *args, **kwargs)

    def flushAsync(self, onSuccess, onError, *args, **kwargs):
        self._processAsync(operations.Flush, onSuccess, onError, *args, **kwargs)



+9 −0
Original line number Diff line number Diff line
@@ -73,6 +73,15 @@ class Client(BaseClient):
    def pipedPush(self, *args, **kwargs):
        return self._process(operations.P2pPipedPush, *args, **kwargs)


    def getVersion(self, *args, **kwargs):
        """
            Arguments: key -> The key you are seeking version information for.
            Returns a protobuf object with the version property that determines the pair's current version.
        """
        return self._process(operations.GetVersion, *args, **kwargs)


    # @RequiresProtocol('2.0.3')
    def flush(self, *args, **kwargs):
        return self._process(operations.Flush, *args, **kwargs)
+25 −0
Original line number Diff line number Diff line
@@ -194,6 +194,31 @@ class GetKeyRange(object):
    def onError(e):
        raise e

class GetVersion(object):

    @staticmethod
    def build(key):
        (m,_) = _buildMessage(messages.Message.GETVERSION, key)
        return (m, None)

    @staticmethod
    def parse(m, value):
        try:
            Entry.fromResponse(m, value)
            return m.command.body.keyValue.dbVersion
        except KineticMessageException as e:
            if e.code == 'NOT_FOUND':
                # return None on NOT_FOUND; 'cause dict.get
                return None
            raise

    @staticmethod
    def onError(e):
        if isinstance(e,KineticMessageException):
            if e.code and e.code == 'NOT_FOUND':
                return None
        raise e

class P2pPush(object):

    @staticmethod