Skip to content

Commit

Permalink
Merge branch 'release/v0.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
singulared committed Feb 14, 2017
2 parents bcb68b4 + 92378a4 commit 08b2442
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.7 (2017-02-13)

Fix:

- Sphinx Documentation

## 0.1.6 (2017-02-10)

Fix:
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Riak KV operations Yes
Riak Datatypes Yes
Riak BucketTypes Yes
Custom resolver Yes
Node list support No
Node list support WIP
Custom quorum No
Connections Pool No
Operations timeout No
Security No
Riak Search No
MapReduce No
Riak Search WIP
MapReduce WIP
Tested python versions `3.5, 3.6 <travis_>`__
Tested Riak versions `2.1.3, 2.1.4 <travis_>`__
================================ ==============================
Expand Down
11 changes: 6 additions & 5 deletions aioriak/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ async def new(self, key=None, data=None, content_type='application/json',
A shortcut for manually instantiating a new
:class:`~aioriak.riak_object.RiakObject` or a new
:class:`~aioriak.datatypes.Datatype`, based on the presence and value
of the :attr:`datatype <BucketType.datatype>` bucket property. When
the bucket contains a :class:`~aioriak.datatypes.Datatype`, all
arguments are ignored except ``key``, otherwise they are used to
of the :attr:`datatype <aioriak.bucket.BucketType.datatype>` bucket
property. When the bucket contains a
:class:`~aioriak.datatypes.Datatype`, all arguments are ignored except
``key``, otherwise they are used to
initialize the :class:`~aioriak.riak_object.RiakObject`.
:param key: Name of the key. Leaving this to be None (default)
Expand Down Expand Up @@ -235,7 +236,7 @@ async def delete(self, key, **kwargs):
'''
Deletes a key from Riak. Short hand for
``bucket.new(key).delete()``. See :meth:`RiakClient.delete()
<riak.client.RiakClient.delete>` for options.
<aioriak.client.RiakClient.delete>` for options.
:param key: The key for the object
:type key: string
Expand Down Expand Up @@ -270,7 +271,7 @@ class BucketType:
properties on a Riak bucket type and access buckets within its
namespace.
Async implementation of :class:`riak.bucket.BucketType`
Async implementation of riak.bucket.BucketType
'''
def __init__(self, client, name):
'''
Expand Down
5 changes: 3 additions & 2 deletions aioriak/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from weakref import WeakValueDictionary
from .transport import create_transport
from .bucket import BucketType, Bucket
from riak.resolver import default_resolver
from aioriak.resolver import default_resolver
from riak.util import bytes_to_str, str_to_bytes
from aioriak.datatypes import TYPES

Expand Down Expand Up @@ -134,7 +134,8 @@ def _set_resolver(self, value):

resolver = property(_get_resolver, _set_resolver,
doc='''The sibling-resolution function for this client.
Defaults to :func:`riak.resolver.default_resolver`.''')
Defaults to :func:`aioriak.resolver.default_resolver`.
''')

def close(self):
if not self._closed:
Expand Down
2 changes: 1 addition & 1 deletion aioriak/datatypes/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Counter(Datatype):
'''
A convergent datatype that represents a counter which can be
incremented or decremented. This type can stand on its own or be
embedded within a :class:`~riak.datatypes.Map`.
embedded within a :class:`~aioriak.datatypes.Map`.
'''

type_name = 'counter'
Expand Down
40 changes: 40 additions & 0 deletions aioriak/resolver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2010-present Basho Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


def default_resolver(riak_object):
"""
The default conflict-resolution function, which does nothing. To
implement a resolver, define a function that sets the
:attr:`siblings <aioriak.riak_object.RiakObject.siblings>` property
on the passed :class:`RiakObject <aioriak.riak_object.RiakObject>`
instance to a list containing a single :class:`RiakContent
<aioriak.content.RiakContent>` object.
:param riak_object: an object-in-conflict that will be resolved
:type riak_object: :class:`RiakObject <aioriak.riak_object.RiakObject>`
"""
pass


def last_written_resolver(riak_object):
"""
A conflict-resolution function that resolves by selecting the most
recently-modified sibling by timestamp.
:param riak_object: an object-in-conflict that will be resolved
:type riak_object: :class:`RiakObject <aioriak.riak_object.RiakObject>`
"""
riak_object.siblings = [max(riak_object.siblings,
key=lambda x: x.last_modified), ]
4 changes: 2 additions & 2 deletions docs/bucket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ If Bucket Types are not specified, the *default* bucket
type is used. These buckets should be created via the :meth:`bucket()
<aioriak.client.RiakClient.bucket>` method on the client object, like so::

import riak
import aioriak

async def go():
client = await riak.RiakClient.create()
client = await aioriak.RiakClient.create()
mybucket = client.bucket('mybucket')

Buckets with a user-specified Bucket Type can also be created via the same
Expand Down
2 changes: 1 addition & 1 deletion docs/datatypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ All Data Types must be stored in buckets bearing a
the ``allow_mult`` property set to ``true``.

These Data Types are stored just like :class:`RiakObjects
<riak.riak_object.RiakObject>`, so size constraints that apply to
<aioriak.riak_object.RiakObject>`, so size constraints that apply to
normal Riak values apply to Riak Data Types too.

An in-depth discussion of Data Types, also known as CRDTs,
Expand Down
12 changes: 6 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Riak KV operations Yes
Riak Datatypes Yes
Riak BucketTypes Yes
Custom resolver Yes
Node list support No
Node list support WIP
Custom quorum No
Connections Pool No
Operations timout No
Security No
Riak Search No
MapReduce No
Tested python versions `3.5.0, 3.5.1 <travis_>`_
Tested Riak versions `2.1.3 <travis_>`_
Riak Search WIP
MapReduce WIP
Tested python versions `3.5, 3.6 <travis_>`__
Tested Riak versions `2.1.3, 2.1.4 <travis_>`__
================================ ==============================

Installation
Expand All @@ -40,7 +40,7 @@ Requirements
------------

- Python >= 3.5
- riak>=2.1.3
- riak==2.7.0

Contribute
----------
Expand Down
10 changes: 5 additions & 5 deletions docs/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Values & Objects

Keys in Riak are namespaced into :class:`buckets
<aioriak.bucket.Bucket>`, and their associated values are represented
by :class:`objects <RiakObject>`, not to be confused with Python
"objects". A :class:`RiakObject` is a container for the key, the
by :class:`objects <aioriak.riak_object.RiakObject>`, not to be confused with Python
"objects". A :class:`aioriak.riak_object.RiakObject` is a container for the key, the
:ref:`vclock`, the value(s) and any metadata associated with the
value(s).

Expand Down Expand Up @@ -121,11 +121,11 @@ written again. How you choose to resolve the conflict is up to you,
but you can automate the process using a :attr:`resolver
<RiakObject.resolver>` function.

.. autofunction:: riak.resolver.default_resolver
.. autofunction:: riak.resolver.last_written_resolver
.. autofunction:: aioriak.resolver.default_resolver
.. autofunction:: aioriak.resolver.last_written_resolver

If you do not supply a resolver function, or your resolver leaves
multiple siblings present, accessing the :ref:`object_accessors` will
result in a :exc:`ConflictError <riak.ConflictError>` being raised.
result in a :exc:`ConflictError <aioriak.error.ConflictError>` being raised.

.. autoexception:: aioriak.error.ConflictError
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
from setuptools import setup, find_packages
import codecs
import os
from commands import (docker_build, docker_start, docker_stop, setup_riak,
create_bucket_types, Test)


HERE = os.path.abspath(os.path.dirname(__file__))


def read(*parts):
"""
Build an absolute path from *parts* and and return the contents of the
resulting file. Assume UTF-8 encoding.
"""
with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
return f.read()

setup(
name='aioriak',
version='0.1.6',
version='0.1.7',
description='Async implementation of Riak DB python client',
long_description=read("README.rst"),
author='Makc Belousov',
author_email='m.belousov@rambler-co.ru',
url='https://github.com/rambler-digital-solutions/aioriak',
Expand Down

0 comments on commit 08b2442

Please sign in to comment.