Couchbase C Client  3.3.14
Asynchronous C Client for Couchbase

Detailed Description

libuv integration

libuv is a cross platform event framework using a completion-based programming model. Since most distributions do not offer up-to-date libuv binary packages and because libuv is constantly evolving itself, binary packages are not provided. The source code for this plugin is actually shipped with the headers of libcouchbase.

If you built libuv together with libcouchbase (and thus there exists a library called libcouchbase_libuv then you may simply include this file and initialize the iops structure.

Otherwise you should ensure that <libcouchbase/plugins/io/libuv/plugin-libuv.c> is compiled into an object, and that the LCBUV_EMBEDDED_SOURCE macro is defined for both the compiled object and any code in your application that is using the module, thus:

//uv-stub.c
#include <libcouchbase/plugins/io/libuv/plugin-libuv.c>

Then, in your application

#include <libcouchbase/libuv_io_opts.h>
lcb_io_opt_t *io;
options.v.v0.loop = uv_default_loop();
options.v.v0.startsop_noop = 1;
lcb_create_libuv_io_opts(0, &io, &options);
LCBUV_API lcb_STATUS lcb_create_libuv_io_opts(int version, lcb_io_opt_t *io, lcbuv_options_t *options)
Use this if using an existing uv_loop_t.
Options passed to the iops constructure.
Definition libuv_io_opts.h:88

And then compile as

$ gcc -o myapp uv-stub.c main.c -DLCBUV_EMBEDDED_SOURCE

Function Documentation

◆ lcb_create_libuv_io_opts()

LCBUV_API lcb_STATUS lcb_create_libuv_io_opts ( int version,
lcb_io_opt_t * io,
lcbuv_options_t * options )

Use this if using an existing uv_loop_t.

Parameters
versionSet this to 0
[out]ioa pointer to an io pointer. Will be populated on success
optionsthe options to be passed. From libcouchbase this is a void* parameter.

Data Structure Documentation

◆ lcbuv_options_t

struct lcbuv_options_t

Options passed to the iops constructure.

You will most likely want to set the 'startsop_noop' field to true if you are using an async application.

Data Fields
int version
union lcbuv_options_t.v v