Commit 29fe2616 authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

Added ClusterVersion exception

parent 790c8111
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ This section will document changes to the library since the last release

## New features
- Added IPv6 address support on all clients (Issue #8)
- Added new exception type ClusterVersionFailureException (Requires drive version 2.0.4)

## Bug Fixes
- Fixex bug that caused close() and connect() to fail on a connection that faulted (Issue #7)
+4 −3
Original line number Diff line number Diff line
@@ -127,10 +127,11 @@ class BaseAsync(Client):
            return #skip the rest

        def innerSuccess(header, value):
            if (header.command.status.code != messages.Message.Status.SUCCESS) :
                onError(common.KineticMessageException(header.command.status))
            else:
            try:
                operations._check_status(header)
                onSuccess(header, value)
            except Exception as ex:
                onError(ex)

        # get sequence
        self.update_header(header)
+0 −4
Original line number Diff line number Diff line
@@ -327,10 +327,6 @@ class BaseClient(object):
    def send(self, header, value):
       self.network_send(header, value)
       resp = self.network_recv()

       if (resp[0].command.status.code != messages.Message.Status.SUCCESS) :
            raise common.KineticMessageException(resp[0].command.status)

       return resp

    ### with statement support ###
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ class Client(BaseClient):
                self.update_header(header)
                # send message synchronously
                header, value = self.send(header, value)
            operations._check_status(header)
            return op.parse(header, value)
        except Exception as e:
            return op.onError(e)
+7 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ DEFAULT_CONNECT_TIMEOUT = 0.1
DEFAULT_SOCKET_TIMEOUT = 5
DEFAULT_CHUNK_SIZE = 4096


class Entry(object):

    #RPC: Note, you could build this as a class method, if you wanted the fromMessage to build
@@ -42,7 +43,7 @@ class Entry(object):
        elif (header.command.status.code == messages.Message.Status.NOT_FOUND):
            return None
        else:
            raise KineticMessageException(header.command.status)
            raise KineticClientException("Invalid response status, can' build entry from response.")

    def __init__(self, key, value, metadata=None):
        self.key = key
@@ -141,6 +142,11 @@ class KineticMessageException(KineticException):
    def __str__(self):
        return self.code + (': %s' % self.value if self.value else '')

class ClusterVersionFailureException(KineticMessageException):

    def __init__(self, status, cluster_version):
        super(ClusterVersionFailureException, self).__init__(status)
        self.cluster_version = cluster_version

class HmacAlgorithms:
    INVALID_HMAC_ALGORITHM = -1 # Must come first, so default is invalid
Loading