Code Monkey home page Code Monkey logo

riakpool's Introduction

Overview

riakpool is an application for maintaining a dynamic pool of protocol buffer client connections to a riak database. It ensures that a given connection can only be in use by one external process at a time.

Installation

$ git clone git://github.com/dweldon/riakpool.git
$ cd riakpool
$ make

Interface

The following example gives an overview of the riakpool interface. Please see the complete documentation by running make doc.

1> application:start(riakpool).
ok
2> riakpool:start_pool("127.0.0.1", 8087).
ok
3> riakpool:execute(fun(C) -> riakc_pb_socket:ping(C) end).
{ok,pong}
4> riakpool_client:put(<<"groceries">>, <<"mine">>, <<"eggs">>).
ok
5> riakpool_client:get(<<"groceries">>, <<"mine">>).
{ok,<<"eggs">>}
6> riakpool_client:list_keys(<<"groceries">>).
{ok,[<<"mine">>]}
7> riakpool_client:delete(<<"groceries">>, <<"mine">>).
ok
8> riakpool:count().
1

Note that the use of riakpool_client is completely optional - it is simply a collection of convenience functions which call riakpool:execute/1.

Starting the Pool

Prior to any calls to riakpool:execute/1, the pool must be started. This can be accomplished in one of two ways:

  1. Before the server is started, set the riakpool application environment variables riakpool_host and riakpool_port.
  2. After the server is started, call riakpool:start_pool/0 or riakpool:start_pool/2 (see previous section).

riakpool's People

Contributors

dweldon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.