Skip to content

chatid/prosody-riak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prosody-riak

Riak module for prosody; currently only hits the protobuf interface, and the API is very low level.

The library is non-blocking, and performs connection pooling under the hood for you.

Dependencies

  • prosody with a working net.server.addclient (commited to trunk on December 23 2013)
  • lua-pb

Usage

Use module:depends to load this library

handle = pb.new ( servers [, client_id] )

  • servers is an array of dictionaries with fields:
    • host (required string)
    • port (required number)
    • sslctx (optional table)
    • max_connections (optional number)

handle:rpc ( message_type , data , callback )

  • message_type is the riak command you want to issue; a list can be found in the riak documentation
  • data can be nil for commands that have no parameters; otherwise it is a table that matches the protobuf message
  • callback will be called with the response as a single argument or (nil,err) in case of error

Example

myriak = module:depends "riak/pb".new {
	{ host = "127.0.0.1" , port = 8087 , max_connections = 10 } ;
}
myriak:rpc ( "RpbPingReq" , nil , function ( res , err )
	if res == nil then
		print ( "Failure!" , err )
		return
	end
	print ( "PONG" )
end )

Releases

No releases published

Packages

No packages published

Languages