Client & Connections

To connect to a Riak cluster, you must create a RiakClient object. The default configuration connects to a Riak node on localhost with the default ports. The below instantiation statements are all equivalent:

from aioriak import RiakClient


client = RiakClient()

async def go():
    client = await RiakClient.create(host='127.0.0.1', port=8087)

Note

Connections are not established until you attempt to perform an operation. If the host or port are incorrect, you will not get an error raised immediately.

Client objects

Client-level Operations

Some operations are not scoped by buckets or bucket types and can be performed on the client directly:

Accessing Bucket Types and Buckets

Most client operations are on bucket type objects, the bucket objects they contain or keys within those buckets. Use the bucket_type or bucket methods for creating bucket types and buckets that will proxy operations to the called client.

Bucket Type Operations

Bucket Operations

Key-level Operations

Serialization

The client supports automatic transformation of Riak responses into Python types if encoders and decoders are registered for the media-types. Supported by default are application/json and text/plain.