Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Perl Client for Couchbase
C++ Perl C XS

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/Couchbase
t
Async.xs
Changes
Client.xs
Client_multi.xs
MANIFEST
MANIFEST.SKIP
Makefile.PL
PLCB_Config.pm
README.pod
async.c
async_callbacks.c
async_events.c
callbacks.c
convert.c
couchbase-client.kpf
ctor.c
error_constants.pl
idx_constants.pl
ignore.txt
perl-couchbase-async.h
perl-couchbase.h
plcb-return.h
plcb-util.h
print_constants.pl

README.pod

Introduction

Couch::Couchbase is a Perl client for Couchbase (http://www.couchbase.org).

The couchbase client is a smart, vbucket-aware client. What this means is that Couchbase::Client can tap into your Couchbase cluster, with the client needing to be able to access (initially) only a single entry point.

The module provides:

Synchronous Interface: Couchbase::Client

This is the simplest and most tested interface. The methods are self-explanatory. Additionally, the return type is complex and detailed, allowing error reporting for any unexpected conditions (something severely lacking in any Memcache client implementation).

Legacy Interface: Couchbase::Client::Compat

Drop-in replacement for Cache::Memcached and Cache::Memcached::Fast.

I can't say it's 100% compatible yet, but the basic methods have been implemented. Internally it just wraps around the new interface

Asynchronous Framework for Perl: Couchbase::Client::Async

Provides the necessary functions and utilities needed to make a POE, IO::Async, etc. client for Couchbase.

Mock Server Interface: Couchbase::MockServer

Interface to the Java CouchbaseMock.jar. This is a work in progress.

Installing

I will be focusing on installing and configuring libcouchbase itself, the C client library. It is assumed you have a functional installation of the couchbase server somewhere. If not, go to http://www.couchbase.org

To use this module, you should have installed libvbucket (see the links on the side here http://www.couchbase.com/develop/c/current).

As of 01/28/2011, you will need to download libcouchbase itself from github (the current release versions contain bugs which may break this module).

Building libcouchbase

libcouchbase itself depends on libvbucket, so make sure to install that (and its development libraries) first.

Currently, I know of these dependencies:

libevent >= 1.4

For embedded default event loop functionality

java

For the Perl and C tests

Additionally, libcouchbase depends on header files available from the engine-pu branch of the memcached project. Note that actually building memcached itself is not required.

Your best bet would be to do something like this:

    ~$ mkdir couch
    ~$ git clone https://github.com/memcached/memcached.git -b engine-pu couch/memcached
    ~$ git clone https://github.com/couchbase/libcouchbase.git couch/libcouchbase
    
    #Get vbucket stuff:
    
    # I pick RPM, since that's what my target production platform is:
    
    ~$ wget http://packages.couchbase.com/clients/c/libvbucket1-1.8.0.1-1.x86_64.rpm
    ~$ rpm -ivh libvbucket1-1.8.0.1-1.x86_64.rpm
    ~$ wget http://packages.couchbase.com/clients/c/libvbucket-1.8.0.1.tar.gz
    ~$ cd couch; tar xf ../libvbucket-1.8.0.1.tar.gz
    ~$ ln -s libvbucket-1.8.0.1 libvbucket
    
    
    # Note for CentOS/RHEL 5 users, you will need to perform the autorun
    # to generate the 'configure' script on a newer platform, then copy it over
    # to your target platform
    
    
    ~$ cd couch/libcouchbase
    ~$ ./config/autorun.sh
    
    #make sure we know about the new memcached (and vbucket) headers:
    
    ~$ CPPFLAGS='-I../memcached/include -I../libvbucket/include' ./configure
    
    # (EL5: If configure complains about not finding libvbucket, try:)
        ~$ ln -s /usr/lib64/libvbucket.so.1 /usr/lib64/libvbucket.so
    
    
    ~$ make
    
    #optional, run some tests:
    ~$ make check

Building Couchbase::Client

To build the perl client, you should edit the PLCB_Config.pm file, and change the keys COUCHBASE_INCLUDE_PATH and COUCHBASE_LIBRARY_PATH to their appropriate locations.

If you were following the example above, your keys should look like this

    COUCHBASE_INCLUDE_PATH => "~/couch/libcouchbase/include",
    COUCHBASE_LIBRARY_PATH => "~/couch/libcouchbase/.libs"
    
    #the '.libs' is an Autoconf thing, it seems.

run

    $ perl Makefile.PL #you know the drill..
    $ make test

There are some top-level scripts. Some have meaning to only the author, some might be useful.

Also, check out the runnable modules in the t/ directory

Something went wrong with that request. Please try again.