pyrakoon.protocol

Arakoon protocol implementation

pyrakoon.protocol.RESULT_SUCCESS = 0

Success return code

pyrakoon.protocol.PROTOCOL_VERSION = 1

Protocol version

class pyrakoon.protocol.Request(count)[source]

Bases: object

Wrapper for data requests generated by Type.receive()

count

Number of requested bytes

class pyrakoon.protocol.Result(value)[source]

Bases: object

Wrapper for value results generated by Type.receive()

value

Result value

class pyrakoon.protocol.Type[source]

Bases: object

Base type for Arakoon serializable types

PACKER = None

Struct instance used by default serialize() and receive() implementations

Type:struct.Struct
check(value)[source]

Check whether a value is valid for this type

Parameters:value (object) – Value to test
Returns:Whether the value is valid for this type
Return type:bool
serialize(value)[source]

Serialize value

Parameters:value (object) – Value to serialize
Returns:Iterable of bytes of the serialized value
Return type:iterable of str
receive()[source]

Receive and parse a result from the server

This method is a coroutine which yields Request instances, and finally a Result. When a Request instance is yielded, the number of bytes as specified in the count attribute should be sent back.

If finally a Result instance is yield, its value attribute contains the actual message result.

See:Message.receive()
class pyrakoon.protocol.String[source]

Bases: pyrakoon.protocol.Type

String type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.UnsignedInteger(bits, pack)[source]

Bases: pyrakoon.protocol.Type

Unsigned integer type

Initialize an unsigned integer type

Parameters:
  • bits (int) – Bits containing the value
  • pack (str) – Struct type, passed to struct.Struct
check(value)[source]
class pyrakoon.protocol.SignedInteger(bits, pack)[source]

Bases: pyrakoon.protocol.Type

Signed integer type

Initialize an unsigned integer type

Parameters:
  • bits (int) – Bits containing the value
  • pack (str) – Struct type, passed to struct.Struct
check(value)[source]
class pyrakoon.protocol.Float[source]

Bases: pyrakoon.protocol.Type

Float type

PACKER = <Struct object>
check(value)[source]
class pyrakoon.protocol.Bool[source]

Bases: pyrakoon.protocol.Type

Bool type

PACKER = <Struct object>
TRUE = '\x01'
FALSE = '\x00'
check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.Unit[source]

Bases: pyrakoon.protocol.Type

Unit type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.Step[source]

Bases: pyrakoon.protocol.Type

Step type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.Option(inner_type)[source]

Bases: pyrakoon.protocol.Type

Option type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.List(inner_type)[source]

Bases: pyrakoon.protocol.Type

List type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.Array(inner_type)[source]

Bases: pyrakoon.protocol.Type

Array type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.Product(*inner_types)[source]

Bases: pyrakoon.protocol.Type

Product type

check(value)[source]
serialize(value)[source]
receive()[source]
class pyrakoon.protocol.StatisticsType[source]

Bases: pyrakoon.protocol.Type

Statistics type

check(value)[source]
serialize(value)[source]
receive()[source]
pyrakoon.protocol.ALLOW_DIRTY_ARG = ('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False)

Well-known allow_dirty argument

class pyrakoon.protocol.Message[source]

Bases: object

Base type for Arakoon command messages

MASK = 2986278912

Generic command mask value

TAG = None

Tag (code) of the command

ARGS = None

Arguments required for the command

RETURN_TYPE = None

Return type of the command

DOC = None

Docstring for methods exposing this command

serialize()[source]

Serialize the command

Returns:Iterable of bytes of the serialized version of the command
Return type:iterable of str
receive()[source]

Read and deserialize the return value of the command

Running as a coroutine, this method can read and parse the server result value once this command has been submitted.

This method yields values of type Request to request more data (which should then be injected using the send() method of the coroutine). The number of requested bytes is provided in the count attribute of the Request object.

Finally a Result value is generated, which contains the server result in its value attribute.

Raises ArakoonError:
 Server returned an error code
See:pyrakoon.utils.process_blocking()
class pyrakoon.protocol.Hello(client_id, cluster_id)[source]

Bases: pyrakoon.protocol.Message

“hello” message

TAG = 2986278913
ARGS = (('client_id', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('cluster_id', <pyrakoon.protocol.String object at 0x7f462c74f690>))
RETURN_TYPE = <pyrakoon.protocol.String object>
DOC = u'\nSend a "hello" command to the server\n\nThis method will return the string returned by the server when\nreceiving a "hello" command.\n\n:param client_id: Identifier of the client\n:type client_id: :class:`str`\n:param cluster_id: Identifier of the cluster connecting to. This must match the cluster configuration.\n:type cluster_id: :class:`str`\n\n:return: Message returned by the server\n:rtype: :class:`str`\n'
client_id

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

cluster_id

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.WhoMaster[source]

Bases: pyrakoon.protocol.Message

“who_master” message

TAG = 2986278914
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.Option object>
DOC = u'\nSend a "who_master" command to the server\n\nThis method returns the name of the current master node in the Arakoon\ncluster.\n\n:return: Name of cluster master node\n:rtype: :class:`str`\n'
class pyrakoon.protocol.Exists(allow_dirty, key)[source]

Bases: pyrakoon.protocol.Message

“exists” message

TAG = 2986278919
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('key', <pyrakoon.protocol.String object at 0x7f462c74f690>))
RETURN_TYPE = <pyrakoon.protocol.Bool object>
DOC = u'\nSend an "exists" command to the server\n\nThis method returns a boolean which tells whether the given `key` is\nset on the server.\n\n:param key: Key to test\n:type key: :class:`str`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: Whether the given key is set on the server\n:rtype: :class:`bool`\n'
key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Get(allow_dirty, key)[source]

Bases: pyrakoon.protocol.Message

“get” message

TAG = 2986278920
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('key', <pyrakoon.protocol.String object at 0x7f462c74f690>))
RETURN_TYPE = <pyrakoon.protocol.String object>
DOC = u'\nSend a "get" command to the server\n\nThis method returns the value of the requested key.\n\n:param key: Key to retrieve\n:type key: :class:`str`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: Value for the given key\n:rtype: :class:`str`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Set(key, value)[source]

Bases: pyrakoon.protocol.Message

“set” message

TAG = 2986278921
ARGS = (('key', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('value', <pyrakoon.protocol.String object at 0x7f462c74f690>))
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend a "set" command to the server\n\nThis method sets a given key to a given value on the server.\n\n:param key: Key to set\n:type key: :class:`str`\n:param value: Value to set\n:type value: :class:`str`\n'
key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

value

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Delete(key)[source]

Bases: pyrakoon.protocol.Message

“delete” message

TAG = 2986278922
ARGS = (('key', <pyrakoon.protocol.String object at 0x7f462c74f690>),)
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend a "delete" command to the server\n\nThis method deletes a given key from the cluster.\n\n:param key: Key to delete\n:type key: :class:`str`\n'
key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.PrefixKeys(allow_dirty, prefix, max_elements)[source]

Bases: pyrakoon.protocol.Message

“prefix_keys” message

TAG = 2986278924
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('prefix', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('max_elements', <pyrakoon.protocol.SignedInteger object at 0x7f462c744750>, -1))
RETURN_TYPE = <pyrakoon.protocol.List object>
DOC = u'\nSend a "prefix_keys" command to the server\n\nThis method retrieves a list of keys from the cluster matching a given\nprefix. A maximum number of returned keys can be provided. If set to\n*-1* (the default), all matching keys will be returned.\n\n:param prefix: Prefix to match\n:type prefix: :class:`str`\n:param max_elements: Maximum number of keys to return\n:type max_elements: :class:`int`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: Keys matching the given prefix\n:rtype: iterable of :class:`str`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

prefix

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

max_elements

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.TestAndSet(key, test_value, set_value)[source]

Bases: pyrakoon.protocol.Message

“test_and_set” message

TAG = 2986278925
ARGS = (('key', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('test_value', <pyrakoon.protocol.Option object at 0x7f462c73c5d0>), ('set_value', <pyrakoon.protocol.Option object at 0x7f462c73c610>))
RETURN_TYPE = <pyrakoon.protocol.Option object>
DOC = u'\nSend a "test_and_set" command to the server\n\nWhen `test_value` is not :data:`None`, the value for `key` will only be\nmodified if the existing value on the server is equal to `test_value`.\nWhen `test_value` is :data:`None`, the `key` will only be set of there\nwas no value set for the `key` before.\n\nWhen `set_value` is :data:`None`, the `key` will be deleted on the server.\n\nThe original value for `key` is returned.\n\n:param key: Key to act on\n:type key: :class:`str`\n:param test_value: Expected value to test for\n:type test_value: :class:`str` or :data:`None`\n:param set_value: New value to set\n:type set_value: :class:`str` or :data:`None`\n\n:return: Original value of `key`\n:rtype: :class:`str`\n'
key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

test_value

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

set_value

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Sequence(steps, sync)[source]

Bases: pyrakoon.protocol.Message

“sequence” and “synced_sequence” message

ARGS = (('steps', <pyrakoon.protocol.List object at 0x7f462c73c390>), ('sync', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False))
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend a "sequence" or "synced_sequence" command to the server\n\nThe operations passed to the constructor should be instances of\nimplementations of the :class:`pyrakoon.sequence.Step` class. These\noperations will be executed in an all-or-nothing transaction.\n\n:param steps: Steps to execute\n:type steps: iterable of :class:`pyrakoon.sequence.Step`\n:param sync: Use *synced_sequence*\n:type sync: :class:`bool`\n'
sequence

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

sync

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

serialize()[source]
class pyrakoon.protocol.Range(allow_dirty, begin_key, begin_inclusive, end_key, end_inclusive, max_elements)[source]

Bases: pyrakoon.protocol.Message

“Range” message

TAG = 2986278923
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('begin_key', <pyrakoon.protocol.Option object at 0x7f462c73c8d0>), ('begin_inclusive', <pyrakoon.protocol.Bool object at 0x7f462c744250>), ('end_key', <pyrakoon.protocol.Option object at 0x7f462c73c990>), ('end_inclusive', <pyrakoon.protocol.Bool object at 0x7f462c744250>), ('max_elements', <pyrakoon.protocol.SignedInteger object at 0x7f462c744750>, -1))
RETURN_TYPE = <pyrakoon.protocol.List object>
DOC = u'\nSend a "range" command to the server\n\nThe operation will return a list of keys, in the range between\n`begin_key` and `end_key`. The `begin_inclusive` and `end_inclusive`\nflags denote whether the delimiters should be included.\n\nThe `max_elements` flag can limit the number of returned keys. If it is\nnegative, all matching keys are returned.\n\n:param begin_key: Begin of range\n:type begin_key: :class:`str`\n:param begin_inclusive: `begin_key` is in- or exclusive\n:type begin_inclusive: :class:`bool`\n:param end_key: End of range\n:type end_key: :class:`str`\n:param end_inclusive: `end_key` is in- or exclusive\n:param max_elements: Maximum number of keys to return\n:type max_elements: :class:`int`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: List of matching keys\n:rtype: iterable of :class:`str`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

begin_key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

begin_inclusive

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

end_key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

end_inclusive

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

max_elements

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.RangeEntries(allow_dirty, begin_key, begin_inclusive, end_key, end_inclusive, max_elements)[source]

Bases: pyrakoon.protocol.Message

“RangeEntries” message

TAG = 2986278927
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('begin_key', <pyrakoon.protocol.Option object at 0x7f462c7aa950>), ('begin_inclusive', <pyrakoon.protocol.Bool object at 0x7f462c744250>), ('end_key', <pyrakoon.protocol.Option object at 0x7f462c7aa4d0>), ('end_inclusive', <pyrakoon.protocol.Bool object at 0x7f462c744250>), ('max_elements', <pyrakoon.protocol.SignedInteger object at 0x7f462c744750>, -1))
RETURN_TYPE = <pyrakoon.protocol.List object>
DOC = u'\nSend a "range_entries" command to the server\n\nThe operation will return a list of (key, value) tuples, for keys in the\nrange between `begin_key` and `end_key`. The `begin_inclusive` and\n`end_inclusive` flags denote whether the delimiters should be included.\n\nThe `max_elements` flag can limit the number of returned items. If it is\nnegative, all matching items are returned.\n\n:param begin_key: Begin of range\n:type begin_key: :class:`str`\n:param begin_inclusive: `begin_key` is in- or exclusive\n:type begin_inclusive: :class:`bool`\n:param end_key: End of range\n:type end_key: :class:`str`\n:param end_inclusive: `end_key` is in- or exclusive\n:type end_inclusive: :class:`bool`\n:param max_elements: Maximum number of items to return\n:type max_elements: :class:`int`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: List of matching (key, value) pairs\n:rtype: iterable of `(str, str)`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

begin_key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

begin_inclusive

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

end_key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

end_inclusive

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

max_elements

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.MultiGet(allow_dirty, keys)[source]

Bases: pyrakoon.protocol.Message

“multi_get” message

TAG = 2986278929
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('keys', <pyrakoon.protocol.List object at 0x7f462c7aab10>))
RETURN_TYPE = <pyrakoon.protocol.List object>
DOC = u'\nSend a "multi_get" command to the server\n\nThis method returns a list of the values for all requested keys.\n\n:param keys: Keys to look up\n:type keys: iterable of :class:`str`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: Requested values\n:rtype: iterable of :class:`str`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

keys

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.MultiGetOption(allow_dirty, keys)[source]

Bases: pyrakoon.protocol.Message

“multi_get_option” message

TAG = 2986278961
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('keys', <pyrakoon.protocol.List object at 0x7f462c7a39d0>))
RETURN_TYPE = <pyrakoon.protocol.Array object>
DOC = u'\nSend a "multi_get_option" command to the server\n\nThis method returns a list of value options for all requested keys.\n\n:param keys: Keys to look up\n:type keys: iterable of :class:`str`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: Requested values\n:rtype: iterable of (`str` or `None`)\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

keys

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.ExpectProgressPossible[source]

Bases: pyrakoon.protocol.Message

“expect_progress_possible” message

TAG = 2986278930
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.Bool object>
DOC = u'\nSend a "expect_progress_possible" command to the server\n\nThis method returns whether the master thinks progress is possible.\n\n:return: Whether the master thinks progress is possible\n:rtype: :class:`bool`\n'
class pyrakoon.protocol.GetKeyCount[source]

Bases: pyrakoon.protocol.Message

“get_key_count” message

TAG = 2986278938
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.UnsignedInteger object>
DOC = u'\nSend a "get_key_count" command to the server\n\nThis method returns the number of items stored in Arakoon.\n\n:return: Number of items stored in the database\n:rtype: :class:`int`\n'
class pyrakoon.protocol.UserFunction(function, argument)[source]

Bases: pyrakoon.protocol.Message

“user_function” message

TAG = 2986278933
ARGS = (('function', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('argument', <pyrakoon.protocol.Option object at 0x7f462c7a3050>))
RETURN_TYPE = <pyrakoon.protocol.Option object>
DOC = u'\nSend a "user_function" command to the server\n\nThis method returns the result of the function invocation.\n\n:param function: Name of the user function to invoke\n:type function: :class:`str`\n:param argument: Argument to pass to the function\n:type argument: :class:`str` or :data:`None`\n\n:return: Result of the function invocation\n:rtype: :class:`str` or :data:`None`\n'
function

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

argument

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Confirm(key, value)[source]

Bases: pyrakoon.protocol.Message

“confirm” message

TAG = 2986278940
ARGS = (('key', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('value', <pyrakoon.protocol.String object at 0x7f462c74f690>))
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend a "confirm" command to the server\n\nThis method sets a given key to a given value on the server, unless\nthe value bound to the key is already equal to the provided value, in\nwhich case the action becomes a no-op.\n\n:param key: Key to set\n:type key: :class:`str`\n:param value: Value to set\n:type value: :class:`str`\n'
key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

value

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Assert(allow_dirty, key, value)[source]

Bases: pyrakoon.protocol.Message

“assert” message

TAG = 2986278934
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('key', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('value', <pyrakoon.protocol.Option object at 0x7f462c77af50>))
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend an "assert" command to the server\n\n`assert key vo` throws an exception if the value associated with the\nkey is not what was expected.\n\n:param key: Key to check\n:type key: :class:`str`\n:param value: Optional value to compare\n:type value: :class:`str` or :data:`None`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

value

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.AssertExists(allow_dirty, key)[source]

Bases: pyrakoon.protocol.Message

“assert_exists” message

TAG = 2986278953
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('key', <pyrakoon.protocol.String object at 0x7f462c74f690>))
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend an "assert_exists" command to the server\n\n`assert_exists key` throws an exception if the key doesn\'t exist in\nthe database.\n\n:param key: Key to check\n:type key: :class:`str`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.RevRangeEntries(allow_dirty, begin_key, begin_inclusive, end_key, end_inclusive, max_elements)[source]

Bases: pyrakoon.protocol.Message

“rev_range_entries” message

TAG = 2986278947
ARGS = (('allow_dirty', <pyrakoon.protocol.Bool object at 0x7f462c744250>, False), ('begin_key', <pyrakoon.protocol.Option object at 0x7f462c793850>), ('begin_inclusive', <pyrakoon.protocol.Bool object at 0x7f462c744250>), ('end_key', <pyrakoon.protocol.Option object at 0x7f462c793890>), ('end_inclusive', <pyrakoon.protocol.Bool object at 0x7f462c744250>), ('max_elements', <pyrakoon.protocol.SignedInteger object at 0x7f462c744750>, -1))
RETURN_TYPE = <pyrakoon.protocol.List object>
DOC = u'\nSend a "rev_range_entries" command to the server\n\nThe operation will return a list of (key, value) tuples, for keys in\nthe reverse range between `begin_key` and `end_key`. The\n`begin_inclusive` and `end_inclusive` flags denote whether the\ndelimiters should be included.\n\nThe `max_elements` flag can limit the number of returned items. If it is\nnegative, all matching items are returned.\n\n:param begin_key: Begin of range\n:type begin_key: :class:`str`\n:param begin_inclusive: `begin_key` is in- or exclusive\n:type begin_inclusive: :class:`bool`\n:param end_key: End of range\n:type end_key: :class:`str`\n:param end_inclusive: `end_key` is in- or exclusive\n:type end_inclusive: :class:`bool`\n:param max_elements: Maximum number of items to return\n:type max_elements: :class:`int`\n:param allow_dirty: Allow reads from slave nodes\n:type allow_dirty: :class:`bool`\n\n:return: List of matching (key, value) pairs\n:rtype: iterable of `(str, str)`\n'
allow_dirty

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

begin_key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

begin_inclusive

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

end_key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

end_inclusive

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

max_elements

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Statistics[source]

Bases: pyrakoon.protocol.Message

“statistics” message

TAG = 2986278931
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.StatisticsType object>
DOC = u'\nSend a "statistics" command to the server\n\nThis method returns some server statistics.\n\n:return: Server statistics\n:rtype: `Statistics`\n'
class pyrakoon.protocol.Version[source]

Bases: pyrakoon.protocol.Message

“version” message

TAG = 2986278952
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.Product object>
DOC = u'\nSend a "version" command to the server\n\nThis method returns the server version.\n\n:return: Server version\n:rtype: `(int, int, int, str)`\n'
class pyrakoon.protocol.DeletePrefix(prefix)[source]

Bases: pyrakoon.protocol.Message

“delete_prefix” message

TAG = 2986278951
ARGS = (('prefix', <pyrakoon.protocol.String object at 0x7f462c74f690>),)
RETURN_TYPE = <pyrakoon.protocol.UnsignedInteger object>
DOC = u'\nSend a "delete_prefix" command to the server\n\n`delete_prefix prefix` will delete all key/value-pairs from the\ndatabase where given `prefix` is a prefix of `key`.\n\n:param prefix: Prefix of binding keys to delete\n:type prefix: :class:`str`\n:return: Number of deleted bindings\n:rtype: :class:`int`\n'
prefix

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Replace(key, value)[source]

Bases: pyrakoon.protocol.Message

“replace” message

TAG = 2986278963
ARGS = (('key', <pyrakoon.protocol.String object at 0x7f462c74f690>), ('value', <pyrakoon.protocol.Option object at 0x7f462c793bd0>))
RETURN_TYPE = <pyrakoon.protocol.Option object>
DOC = u'\nSend a "replace" command to the server\n\n`replace key value` will replace the value bound to the given key with\nthe provided value, and return the old value bound to the key.\nIf `value` is :data:`None`, the key is deleted.\nIf the key was not present in the database, :data:`None` is returned.\n\n:param key: Key to replace\n:type key: :class:`str`\n:param value: Value to set\n:type value: :class:`str` or :data:`None`\n\n:return: Original value bound to the key\n:rtype: :class:`str` or :data:`None`\n'
key

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

value

attrgetter(attr, ...) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

class pyrakoon.protocol.Nop[source]

Bases: pyrakoon.protocol.Message

“nop” message

TAG = 2986278977
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.Unit object>
DOC = u'\nSend a "nop" command to the server\n\nThis enforces consensus throughout a cluster, but has no further\neffects.\n'
class pyrakoon.protocol.GetCurrentState[source]

Bases: pyrakoon.protocol.Message

“get_current_state” message

TAG = 2986278962
ARGS = ()
RETURN_TYPE = <pyrakoon.protocol.String object>
DOC = u'\nSend a "get_current_state" command to the server\n\nThis call returns a string representing the current state of the node,\nand can be used for troubleshooting purposes.\n\n:return: State of the server\n:rtype: :class:`str`\n'
pyrakoon.protocol.build_prologue(cluster)[source]

Return the string to send as prologue

Parameters:cluster (str) – Name of the cluster to which a connection is made
Returns:Prologue to send to the Arakoon server
Return type:str