Module resty.riak.client

“Low level” riak client.

Just a thin wrapper over the “raw” protocol buffers. This API may change and should not be considered stable. It may change between major versions. While not “private”, just be aware it may change. Only the high-level API is considered stable.

Functions

new () Creates a riak object.
set_timeout (self, timeout) Sets the timeout protection for subsequent operations, including the connect method.
connect (self, host, port) Attempts to connect to the remote host and port.
set_keepalive (self, timeout, size) Keeps the current riak connection alive and put it into the ngx_lua cosocket connection pool.
store_object (self, bucket, object) Store a “raw” riak object.
delete_object (self, bucket, key, options) Delete an object.
get_object (self, bucket, key) Retrieve an object.
ping (self) “Ping” the riak server.
get_client_id (self) Retrieve client id.
get_server_info (self) “Ping” the riak server.
get_bucket_props (self, bucket) Get bucket properties
set_bucket_props (self, bucket, properties) Get bucket properties
get_index (self, bucket, index, value) Query a secondary index
update_counter (self, bucket, key, amount, options) Update a counter
get_counter (self, bucket, key) Get the value of a counter Update a counter


Functions

new ()
Creates a riak object.

Returns:

    riak.resty.client “low level” client object
set_timeout (self, timeout)
Sets the timeout protection for subsequent operations, including the connect method.

Parameters:

connect (self, host, port)
Attempts to connect to the remote host and port. Before actually resolving the host name and connecting to the remote backend, this method will always look up the connection pool for matched idle connections created by previous calls of this method.

Parameters:

Returns:

  1. boolean not true on error
  2. string error description
set_keepalive (self, timeout, size)
Keeps the current riak connection alive and put it into the ngx_lua cosocket connection pool. You can specify the max idle timeout when the connection is in the pool and the maximal size of the pool every nginx worker process.

Parameters:

Returns:

  1. boolean not true on error
  2. string error description
store_object (self, bucket, object)
Store a “raw” riak object. The definition of a riak object is defined in the riak PBC as RpbContent.

Parameters:

Returns:

  1. boolean not true on error
  2. string error description

Usage:

     local object = { key = "1", content = { value = "test", content_type = "text/plain" } }
     local rc, err = client:store_object("bucket-name", object)
     -- if using eleveldb, secondary indexes can be added to object before storing
     local object = { key = "1", content = { { value = "test", content_type = "text/plain", indexes = { { key = "foo_bin", value = "bar" } } } }}
delete_object (self, bucket, key, options)
Delete an object.

Parameters:

Returns:

  1. boolean not true on error. If an object does not exist and there is no other error (network, time out, etc) then this will still return true.
  2. string error description
get_object (self, bucket, key)
Retrieve an object.

Parameters:

Returns:

  1. table RpbContent. If not found, then nil.
  2. string error description. If not found, not found will be returned.
ping (self)
“Ping” the riak server.

Parameters:

Returns:

  1. boolean not true on error.
  2. string error description
get_client_id (self)
Retrieve client id.

Parameters:

Returns:

  1. string id
  2. string error description
get_server_info (self)
“Ping” the riak server.

Parameters:

Returns:

  1. table info as defined in RpbGetServerInfoResp
  2. string error description
get_bucket_props (self, bucket)
Get bucket properties

Parameters:

Returns:

  1. table properties as defined in RpbBucketProps
  2. string error description
set_bucket_props (self, bucket, properties)
Get bucket properties

Parameters:

Returns:

  1. boolean successful
  2. string error description
get_index (self, bucket, index, value)
Query a secondary index

Parameters:

update_counter (self, bucket, key, amount, options)
Update a counter

Parameters:

Returns:

  1. value value of counter
  2. string error description
get_counter (self, bucket, key)
Get the value of a counter Update a counter

Parameters:

Returns:

  1. value value of counter
  2. string error description
generated by LDoc 1.3