Skip to content

Instantly share code, notes, and snippets.

@mnunberg
mnunberg / errhandling.md
Last active August 29, 2015 14:10
LCB Error handling

Library Internals: How the library deals with errors

This document is intended to be informative and not authoritative. The library may change its internal behavior regarding error handling without notice.

This document describes how the library internally deals with errors, so that you can get a better idea of what may be happening when debugging various issues.

Error Types

@mnunberg
mnunberg / lcb-boost-asio.cpp
Created November 16, 2014 23:22
lcb+boost
#include <string>
#include <vector>
#include <array>
#include <boost/asio.hpp>
#include <boost/chrono.hpp>
#include <libcouchbase/couchbase.h>
#include <libcouchbase/iops.h>
using std::string;
using std::vector;
#!/usr/bin/perl
use strict;
use warnings;
### Repositories:
my $REPOS = {
RPM => {
5 => {
'32bit' => "http://packages.couchbase.com/rpm/5.5/i386",
#include "readbuf.h"
struct my_bufinfo {
slist_node slnode; /** Node in send queue */
char *buf; /** Buffer for current segment */
size_t nbuf; /** Size of buffer */
size_t offset; /** Offset of buffer */
rdb_SEGMENT *segment; /** Segment for buffer */
};
@mnunberg
mnunberg / lcb-doc.md
Last active August 29, 2015 13:56
lcb docs

// vim: set noexpandtab:

libcouchbase - The C Couchbase Client Library

The C library provides an interface to the Couchbase Cluster from a C application. It is used by many of our client libraries as lower layer which performs network I/O and protocol handling. It may also be used as a standalone client.

The library is known to function on Linux, Mac OS X and Windows. Other platforms may be work but are not routinely tested.

@mnunberg
mnunberg / urldemo.py
Created February 7, 2014 21:05
Manually getting a view result via the Python SDK
#!/usr/bin/env python
from random import choice
import requests
from couchbase import Couchbase
from couchbase.views.params import Query
cb = Couchbase.connect(bucket='beer-sample')
node = choice(cb.server_nodes).replace("8091", "8092")
q = Query()
@mnunberg
mnunberg / parse-git-describe.c
Last active August 29, 2015 13:56
Parse 'git describe' output
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
static void find_delim(char *s, char **res, int *ix)
{
for(; *ix && s[*ix] != '-'; *ix -= 1);
if (*ix) {
s[*ix] = '\0';
*res = s + *ix + 1;

LIBCOUCHBASE BUILD CONFIGURATION

lcbutils

This component contains a collection of utilities for libcouchbase which do not require external or I/O dependencies. This should always be first and be assumed to be the base dependency of other libraries.

It will be built as a static library and linked in with the resultant DSO, so that its symbols are not duplicated twice.

#include <stdio.h>
#include "netbufs.h"
#include "slist-inl.h"
#define MINIMUM(a, b) a < b ? a : b
#define MAXIMUM(a, b) a > b ? a : b
#define BASEALLOC 32768
#define BLOCK_IS_FLUSHED(block) ((block)->flush_start == (block)->cursor)
#define BLOCK_IS_EMPTY(block) ((block)->start == (block)->cursor)
namespace Couchbase
{
internal class SocketPool : ResourcePool {
// .....
public IPooledSocket Acquire()
{
// Log..
IPooledSocket socket = null;
lock(_syncObj)
{