Skip to content

Commit

Permalink
Merged Version 0.8.1 from 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
icorderi committed Dec 2, 2014
2 parents d91cfe2 + 86ca0fc commit 22645d4
Show file tree
Hide file tree
Showing 14 changed files with 560 additions and 483 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ build
dist
*egg-info
*.pyc

# IDEs
.idea/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "kinetic-protocol"]
path = kinetic-protocol
url = https://github.com/Seagate/kinetic-protocol.git
branch = 2.0.6
branch = 3.0.5
20 changes: 16 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
Changes since 0.8.0
Changes since 0.8.1
===========================
This section will document changes to the library since the last release

Changes from 0.8.0 to 0.8.1
===========================
This section will document changes to the library since the last release

## Important
- Kinetic Protocol version updated to [3.0.5](https://github.com/Seagate/kinetic-protocol/tree/3.0.5)

## New features
- Added timeout, time_quanta, priority and early_exit support
- Pin size added to limits
- SHA1 calculation used as default on puts when algorithm and tag not specified.

Changes from 0.7.3 to 0.8.0
===========================

## Important
- Kinetic Protocol version updated to [3.0.0](https://github.com/Seagate/kinetic-protocol/tree/3.0.0)
- Everything requires requires proto 3.0.0 or higher on the device
- Everything requires proto 3.0.0 or higher on the device
- Devices pre 3.0.0 do not have handshakes and will raise Handshake timeout

## New features
Expand Down Expand Up @@ -91,8 +103,8 @@ Kinetic Protocol version updated to 2.0.3
- Added version field on kinetic module.

## Breaking changes
- Renamed Synchronization.ASYNC to Synchronization.WRITETHROUGH
- Renamed Synchronization.SYNC to Synchronization.WRITEBACK
- Renamed Synchronization.ASYNC to Synchronization.WRITEBACK
- Renamed Synchronization.SYNC to Synchronization.WRITETHROUGH

## Bug Fixes
- Fixed issue with asynchronous clients leaving the socket open after _close_ was called (ASOKVAD-263).
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Introduction
============
The [kinetic-protocol](https://github.com/Seagate/kinetic-protocol) python client.
Requires Python 2.7.3 or higher. Python 3.x is not supported.

Installing latest stable release
================================
Expand All @@ -15,6 +16,11 @@ Installing from Source
git submodule update --init
python setup.py develop

For devices with old firmware code:

git checkout 0.7.3
python setup.py develop

Running Tests
=============
The tests need a Kinetic device to run. You can use the simulator available at https://github.com/Seagate/kinetic-java.
Expand Down Expand Up @@ -42,6 +48,15 @@ print c.get('message').value
```
Should print out _hello_ _world_

Troubleshooting during the installation
=======================================
On a brand new system, you might be missing a few things.
If you get an error saying setup tools not installed or missing.
Check the python [setuptools intallation guide](https://pypi.python.org/pypi/setuptools#installation-instructions).
If you needed to installed that, chances are you are missing some requirements to install and compile eventlet on your system.
On debian systems the quickest way is `sudo apt-get install python-eventlet`.


License
-------

Expand Down
2 changes: 1 addition & 1 deletion kinetic-protocol
34 changes: 25 additions & 9 deletions kinetic/admin/adminclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from kinetic import operations
from kinetic.common import KineticException
from functools import wraps

import warnings

def withPin(f):
@wraps(f)
Expand Down Expand Up @@ -75,39 +75,55 @@ def _process(self, op, *args, **kwargs):


def getLog(self, *args, **kwargs):
return self._process(operations.GetLog, *args, **kwargs)
return self._process(operations.GetLog(), *args, **kwargs)

def setClusterVersion(self, *args, **kwargs):
return self._process(operations.SetClusterVersion, *args, **kwargs)
return self._process(operations.SetClusterVersion(), *args, **kwargs)

def updateFirmware(self, *args, **kwargs):
return self._process(operations.UpdateFirmware, *args, **kwargs)
return self._process(operations.UpdateFirmware(), *args, **kwargs)

@withPin
@requiresSsl
def unlock(self, *args, **kwargs):
return self._process(operations.UnlockDevice, *args, **kwargs)
return self._process(operations.UnlockDevice(), *args, **kwargs)

@withPin
@requiresSsl
def lock(self, *args, **kwargs):
return self._process(operations.LockDevice, *args, **kwargs)
return self._process(operations.LockDevice(), *args, **kwargs)

@withPin
@requiresSsl
def erase(self, *args, **kwargs):
return self._process(operations.EraseDevice, *args, **kwargs)
return self._process(operations.EraseDevice(), *args, **kwargs)

@withPin
@requiresSsl
def instantSecureErase(self, *args, **kwargs):
return self._process(operations.SecureEraseDevice, *args, **kwargs)
return self._process(operations.SecureEraseDevice(), *args, **kwargs)

@requiresSsl
def setErasePin(self, *args, **kwargs):
return self._process(operations.SetErasePin(), *args, **kwargs)

@requiresSsl
def setLockPin(self, *args, **kwargs):
return self._process(operations.SetLockPin(), *args, **kwargs)

@requiresSsl
def setACL(self, *args, **kwargs):
return self._process(operations.SetACL(), *args, **kwargs)

@requiresSsl
def setSecurity(self, *args, **kwargs):
"""
Set the access control lists to lock users out of different permissions.
Arguments: aclList -> A list of ACL (Access Control List) objects.
"""
return self._process(operations.Security, *args, **kwargs)
warnings.warn(
"Shouldn't use this function anymore! Use setErasePin/setLockPin/setACL instead.",
DeprecationWarning
)
return self._process(operations.Security(), *args, **kwargs)

26 changes: 13 additions & 13 deletions kinetic/baseasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,41 +182,41 @@ def innerError(e):


def putAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.Put, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.Put(), onSuccess, onError, *args, **kwargs)

def getAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.Get, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.Get(), onSuccess, onError, *args, **kwargs)

def getMetadataAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.GetMetadata, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.GetMetadata(), onSuccess, onError, *args, **kwargs)

def deleteAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.Delete, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.Delete(), onSuccess, onError, *args, **kwargs)

def getNextAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.GetNext, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.GetNext(), onSuccess, onError, *args, **kwargs)

def getPreviousAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.GetPrevious, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.GetPrevious(), onSuccess, onError, *args, **kwargs)

def getKeyRangeAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.GetKeyRange, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.GetKeyRange(), onSuccess, onError, *args, **kwargs)

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

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

def noopAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.Noop, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.Noop(), onSuccess, onError, *args, **kwargs)

def mediaScanAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.MediaScan, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.MediaScan(), onSuccess, onError, *args, **kwargs)

def mediaOptimizeAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.MediaOptimize, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.MediaOptimize(), onSuccess, onError, *args, **kwargs)

def getLogAsync(self, onSuccess, onError, *args, **kwargs):
self._processAsync(operations.GetLog, onSuccess, onError, *args, **kwargs)
self._processAsync(operations.GetLog(), onSuccess, onError, *args, **kwargs)

7 changes: 3 additions & 4 deletions kinetic/baseclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import common
import kinetic_pb2 as messages
import ssl
import operations

ss = socket

Expand Down Expand Up @@ -111,7 +110,7 @@ def connect(self):
# Stage socket on a local variable first
s = self.build_socket(family)
if self.use_ssl:
s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1)
s = ssl.wrap_socket(s)

s.settimeout(self.connect_timeout)
if self.socket_address:
Expand Down Expand Up @@ -235,7 +234,7 @@ def authenticate(self, command):
m = messages.Message()
m.commandBytes = command.SerializeToString()

if self.pin:
if self.pin != None:
m.authType = messages.Message.PINAUTH
m.pinAuth.pin = self.pin
else: # Hmac
Expand Down Expand Up @@ -355,7 +354,7 @@ def send(self, header, value):
m,cmd,value = self.network_recv()
if m.authType == messages.Message.UNSOLICITEDSTATUS:
if self.on_unsolicited:
self.on_unsolicited(resp.status) # uncatched exceptions by the handler will be raised to the caller
self.on_unsolicited(cmd.status) # uncatched exceptions by the handler will be raised to the caller
else:
LOG.warn('Unsolicited status %s received but nobody listening.' % cmd.status.code)
else: done = True
Expand Down
30 changes: 15 additions & 15 deletions kinetic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,61 +42,61 @@ def _process(self, op, *args, **kwargs):
return op.onError(e)

def noop(self, *args, **kwargs):
return self._process(operations.Noop, *args, **kwargs)
return self._process(operations.Noop(), *args, **kwargs)

def put(self, *args, **kwargs):
return self._process(operations.Put, *args, **kwargs)
return self._process(operations.Put(), *args, **kwargs)

def get(self, *args, **kwargs):
return self._process(operations.Get, *args, **kwargs)
return self._process(operations.Get(), *args, **kwargs)

def getMetadata(self, *args, **kwargs):
return self._process(operations.GetMetadata, *args, **kwargs)
return self._process(operations.GetMetadata(), *args, **kwargs)

def delete(self, *args, **kwargs):
return self._process(operations.Delete, *args, **kwargs)
return self._process(operations.Delete(), *args, **kwargs)

def getNext(self, *args, **kwargs):
return self._process(operations.GetNext, *args, **kwargs)
return self._process(operations.GetNext(), *args, **kwargs)

def getPrevious(self, *args, **kwargs):
return self._process(operations.GetPrevious, *args, **kwargs)
return self._process(operations.GetPrevious(), *args, **kwargs)

def getKeyRange(self, *args, **kwargs):
return self._process(operations.GetKeyRange, *args, **kwargs)
return self._process(operations.GetKeyRange(), *args, **kwargs)

def getRange(self, startKey, endKey, startKeyInclusive=True, endKeyInclusive=True, prefetch=64):
return KineticRangeIter(self, startKey, endKey, startKeyInclusive, endKeyInclusive, prefetch)

def push(self, *args, **kwargs):
return self._process(operations.P2pPush, *args, **kwargs)
return self._process(operations.P2pPush(), *args, **kwargs)

def pipedPush(self, *args, **kwargs):
return self._process(operations.P2pPipedPush, *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)
return self._process(operations.GetVersion(), *args, **kwargs)


# @RequiresProtocol('2.0.3')
def flush(self, *args, **kwargs):
return self._process(operations.Flush, *args, **kwargs)
return self._process(operations.Flush(), *args, **kwargs)

# @RequiresProtocol('3.0.0')
def mediaScan(self, *args, **kwargs):
return self._process(operations.MediaScan, *args, **kwargs)
return self._process(operations.MediaScan(), *args, **kwargs)

# @RequiresProtocol('3.0.0')
def mediaOptimize(self, *args, **kwargs):
return self._process(operations.MediaOptimize, *args, **kwargs)
return self._process(operations.MediaOptimize(), *args, **kwargs)

def getLog(self, *args, **kwargs):
return self._process(operations.GetLog, *args, **kwargs)
return self._process(operations.GetLog(), *args, **kwargs)

class KineticRangeIter(object):

Expand Down
Loading

0 comments on commit 22645d4

Please sign in to comment.