Skip to content

Commit

Permalink
Release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
icorderi committed Jul 17, 2015
2 parents 45d13e2 + 4916fe7 commit 8c5095d
Show file tree
Hide file tree
Showing 31 changed files with 943 additions and 132 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
.DS_STORE
build
dist
*egg-info

# Python
build/
dist/
*egg-info/
*.pyc

# IDEs
.idea/

# scripting
tmp/
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 = 3.0.5
branch = 3.0.6
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: python

python:
- "2.7"

install:
- "pip install ."
- "pip install -r requirements.txt"

env:
KINETIC_JAR=$TRAVIS_BUILD_DIR/simulator.jar
KINETIC_CONNECT_TIMEOUT=1.0

before_script: ./build_simulator.sh

script: nosetests
sudo: false
37 changes: 35 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
Changes since 0.8.1
Changes since 0.8.2
===========================
This section will document changes to the library since the last release
>**NOTE:** this section will document changes to the library since the last release
## Important
- Kinetic Protocol version updated to [3.0.6](https://github.com/Seagate/kinetic-protocol/tree/3.0.6)
- Deprecrated classes and methods will be removed on the next major release.

## New features
- Added support for Batch operations
- Added `reverse` parameter on GetKeyRange operation

## Major changes
- `AsyncClient` has been renamed to `Client`
- A new `SecureClient` has been added to `kinetic`.

## Minor changes
- Added env variable _KINETIC_CONNECT_TIMEOUT_ to control default connection timeout.

## Deprecated features
- Old blocking `Client` has been moved to `kinetic.depracated.BlockingClient`
- Old `AdminClient` has been moved to `kinetic.depracated.AdminClient`

## Misc
- Added alias for `AsyncClient = Client` to smooth transition.
- Added alias on `kinetic` for `AdminClient` to smooth transition.

Changes from 0.8.1 to 0.8.2
===========================

## Bug fixes
- Keys with empty values show correctly as '' instead of None
- **WRITEBACK** set as default mode for `put` and `delete` operations

## Misc
- OSX requirements for SSL connections updated.

Changes from 0.8.0 to 0.8.1
===========================
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# **Kinetic-py**
[![Travis](https://img.shields.io/travis/Seagate/kinetic-py.svg)](https://travis-ci.org/Seagate/kinetic-py)
[![PyPI](https://img.shields.io/pypi/v/kinetic.svg)](https://pypi.python.org/pypi/kinetic/0.8.2)
[![PyPI](https://img.shields.io/pypi/l/kinetic.svg)](https://github.com/Seagate/kinetic-py/blob/master/LICENSE/LGPL2.1.md)

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. If you want to connect through SSL on Mac OS X, you will need to have Python 2.7.9.

## Requirements
- Requires Python 2.7.3 or higher.
- Requires Python 2.7.9 on OSX to use SSL

> **NOTE:** Python 3.x is not supported.
Installing latest stable release
================================
pip install kinetic
Expand All @@ -13,13 +23,10 @@ Installing from Source

git clone https://github.com/Seagate/kinetic-py.git
cd kinetic-py
git submodule update --init
python setup.py develop

For devices with old firmware code:

> **NOTE:** for devices with old firmware code get version 0.7.3 of the libray
git checkout 0.7.3
python setup.py develop

Running Tests
=============
Expand All @@ -43,10 +50,11 @@ Getting Started with the basic client
```python
from kinetic import Client
c = Client('localhost', 8123)
c.connect()
c.put('message','hello world')
print c.get('message').value
```
Should print out _hello_ _world_
Should print out _hello world_

Troubleshooting during the installation
=======================================
Expand Down
6 changes: 6 additions & 0 deletions build_simulator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
git clone https://github.com/Seagate/kinetic-java.git
cd kinetic-java
mvn clean package -DskipTests -Dmaven.javadoc.skip=true
jar=$(echo $(pwd)/kinetic-simulator/target/*-jar-with-dependencies.jar)
mv $jar $(pwd)/../simulator.jar
2 changes: 2 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
python setup.py sdist upload
2 changes: 1 addition & 1 deletion kinetic-protocol
21 changes: 16 additions & 5 deletions kinetic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

#@author: Ignacio Corderi

# Logging
import logging
logging.basicConfig()

# Protocol version
from common import local

Expand All @@ -37,17 +41,24 @@
#utils
from utils import buildRange

# client
from client import Client
from asyncclient import AsyncClient
# clients
from greenclient import Client
from secureclient import SecureClient
from threadedclient import ThreadedClient

# common
from common import KeyRange
from common import Entry
from common import Peer

# exceptions
from common import KineticMessageException

# Admin
from admin import AdminClient
# backward compatibility alliases
AsyncClient = Client
from kinetic.deprecated.adminclient import AdminClient
from kinetic import greenclient as client
# Fake old asyncclient module
class AsyncClientCompat(object):
AsyncClient = Client
asyncclient = AsyncClientCompat()
6 changes: 4 additions & 2 deletions kinetic/admin/__init__.py → kinetic/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2014 Seagate Technology.
# Copyright (C) 2015 Seagate Technology.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -16,4 +16,6 @@

#@author: Ignacio Corderi

from adminclient import AdminClient
### This module is deprecated

from kinetic.deprecated import AdminClient
19 changes: 13 additions & 6 deletions kinetic/baseasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#@author: Ignacio Corderi

from client import Client
import deprecated
from common import Entry
import common

Expand All @@ -27,7 +27,7 @@

LOG = logging.getLogger(__name__)

class BaseAsync(Client):
class BaseAsync(deprecated.BlockingClient):

def __init__(self, *args, **kwargs):
super(BaseAsync, self).__init__(*args, socket_timeout=None, **kwargs)
Expand Down Expand Up @@ -132,7 +132,7 @@ def innerError(e):
###


def sendAsync(self, command, value, onSuccess, onError):
def sendAsync(self, command, value, onSuccess, onError, no_ack=False):
if self.faulted: # TODO(Nacho): should we fault through onError on fault or bow up on the callers face?
self._raise(common.ConnectionFaulted("Can't send message when connection is on a faulted state."), onError)
return #skip the rest
Expand All @@ -152,8 +152,9 @@ def innerSuccess(m, response, value):
# get sequence
self.update_header(command)

# add callback to pending dictionary
self._pending[command.header.sequence] = (innerSuccess, onError)
if not no_ack:
# add callback to pending dictionary
self._pending[command.header.sequence] = (innerSuccess, onError)

# transmit
self.network_send(command, value)
Expand All @@ -177,8 +178,14 @@ def innerError(e):
except Exception as e2:
onError(e2)

if 'no_ack' in kwargs:
send_no_ack = True
del kwargs['no_ack']
else:
send_no_ack = False

header, value = op.build(*args, **kwargs)
self.sendAsync(header, value, innerSuccess, innerError)
self.sendAsync(header, value, innerSuccess, innerError, send_no_ack)


def putAsync(self, onSuccess, onError, *args, **kwargs):
Expand Down
17 changes: 14 additions & 3 deletions kinetic/baseclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class BaseClient(object):
def __init__(self, hostname=HOSTNAME, port=PORT, identity=USER_ID,
cluster_version=None, secret=CLIENT_SECRET,
chunk_size=common.DEFAULT_CHUNK_SIZE,
connect_timeout=common.DEFAULT_CONNECT_TIMEOUT,
connect_timeout=common.KINETIC_CONNECT_TIMEOUT,
socket_timeout=common.DEFAULT_SOCKET_TIMEOUT,
socket_address=None, socket_port=0,
defer_read=False,
Expand Down Expand Up @@ -99,7 +99,10 @@ def isConnected(self):
return not self._closed

def build_socket(self, family=ss.AF_INET):
return socket.socket(family)
return socket.socket(family)

def wrap_secure_socket(self, s, ssl_version):
return ssl.wrap_socket(s) #, ssl_version=ssl_version)

def connect(self):
if self._socket:
Expand All @@ -110,7 +113,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)
s = self.wrap_secure_socket(s, ssl.PROTOCOL_TLSv1_2)

s.settimeout(self.connect_timeout)
if self.socket_address:
Expand All @@ -127,6 +130,7 @@ def connect(self):
self._socket.settimeout(self.socket_timeout)

self._sequence = itertools.count()
self._batch_id = itertools.count()
self._closed = False
except:
self._socket = None
Expand Down Expand Up @@ -177,6 +181,7 @@ def close(self):
self._socket = None
self.connection_id = None
self._sequence = itertools.count()
self._batch_id = itertools.count()


def update_header(self, command):
Expand Down Expand Up @@ -360,6 +365,12 @@ def send(self, header, value):
else: done = True
return m,cmd,value

def send_no_ack(self, header, value):
self.network_send(header, value)

def next_batch_id(self):
return self._batch_id.next()

### with statement support ###

def __enter__(self):
Expand Down
Loading

0 comments on commit 8c5095d

Please sign in to comment.