Skip to content

Commit

Permalink
Refactor: rename Membase to Couchbase
Browse files Browse the repository at this point in the history
  • Loading branch information
trondn committed Feb 10, 2011
1 parent 184fee6 commit d356243
Show file tree
Hide file tree
Showing 29 changed files with 614 additions and 609 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
@@ -1,3 +1,3 @@
The following people contributed to libmembase
The following people contributed to libcouchbase

Trond Norbye, trond.norbye@gmail.com
26 changes: 13 additions & 13 deletions Makefile.am
@@ -1,5 +1,5 @@
#
# Copyright 2010 Membase, Inc.
# Copyright 2010 Couchbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
#

#
# Automake file used to build libmembase. Please avoid using propritary
# Automake file used to build libcouchbase. Please avoid using propritary
# make constructs, but keep the syntax portable. To reduce the posibility
# for merge conflicts all list of files should be sorted aphabetically
# (If everyone always add their files to the end of the list that line will
Expand All @@ -25,14 +25,14 @@
#
ACLOCAL_AMFLAGS = -I m4 --force

lib_LTLIBRARIES = libmembase.la memcached_packet_debug.la
lib_LTLIBRARIES = libcouchbase.la memcached_packet_debug.la

pkginclude_HEADERS = \
include/libmembase/callbacks.h \
include/libmembase/membase.h \
include/libmembase/types.h
include/libcouchbase/callbacks.h \
include/libcouchbase/couchbase.h \
include/libcouchbase/types.h

libmembase_la_SOURCES = \
libcouchbase_la_SOURCES = \
src/arithmetic.c \
src/base64.c \
src/cookie.c \
Expand All @@ -50,9 +50,9 @@ libmembase_la_SOURCES = \

# Please remember to update the version info before each release if you
# add / remove functions.
libmembase_la_LDFLAGS=$(LTLIBEVENT) $(LTLIBVBUCKET) $(LTLIBSASL) $(LTLIBSASL2) \
libcouchbase_la_LDFLAGS=$(LTLIBEVENT) $(LTLIBVBUCKET) $(LTLIBSASL) $(LTLIBSASL2) \
-version-info 0:0:0
libmembase_la_CPPFLAGS=$(AM_CPPFLAGS) $(CPPFLAGS) -DLIBMEMBASE_INTERNAL=1
libcouchbase_la_CPPFLAGS=$(AM_CPPFLAGS) $(CPPFLAGS) -DLIBCOUCHBASE_INTERNAL=1

memcached_packet_debug_la_SOURCES= src/packet_debug.c \
src/utilities.c
Expand All @@ -69,17 +69,17 @@ noinst_PROGRAMS = \
example/memrm

example_memcat_SOURCES = example/memcat.c
example_memcat_LDADD = libmembase.la
example_memcat_LDADD = libcouchbase.la
example_memcat_LDFLAGS = $(LTLIBEVENT)

example_memcp_SOURCES = example/memcp.c
example_memcp_LDADD = libmembase.la
example_memcp_LDADD = libcouchbase.la
example_memcp_LDFLAGS = $(LTLIBEVENT)

example_memdump_SOURCES = example/memdump.c
example_memdump_LDADD = libmembase.la
example_memdump_LDADD = libcouchbase.la
example_memdump_LDFLAGS = $(LTLIBEVENT)

example_memrm_SOURCES = example/memrm.c
example_memrm_LDADD = libmembase.la
example_memrm_LDADD = libcouchbase.la
example_memrm_LDFLAGS = $(LTLIBEVENT)
6 changes: 3 additions & 3 deletions README
@@ -1,7 +1,7 @@
Hi!

I started implementing libmembase during the release testing of
Membase. We didn't have a "smart client" in C at the moment, so I had
I started implementing libcouchbase during the release testing of
Couchbase. We didn't have a "smart client" in C at the moment, so I had
to revert to Python/Java to run my tests. A "smart client" is a client
that utilize the REST interface to locate the server hosting a given
vbucket.
Expand All @@ -12,7 +12,7 @@ libmemcached already implements everything I need except for the
the existing codebase, because libmemcached doesn't use vbuckets and
the serverlist is provided by the caller. I'm not saying that it would
be impossible to refactor the code so that it works, but libmemcached
isn't targeted to membase only (and adding vendor-specific logic to
isn't targeted to couchbase only (and adding vendor-specific logic to
a generic library didn't feel right).

You might think that I suffer for the "not invented here" syndrome by
Expand Down
8 changes: 4 additions & 4 deletions configure.ac
@@ -1,5 +1,5 @@
#
# Copyright 2010 Membase, Inc.
# Copyright 2010 Couchbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
#

#
# Configure script to check for all dependencies needed by libmembase.
# Configure script to check for all dependencies needed by libcouchbase.
# I prefer using the macros from the "pandora build system" where I can
# since they adds increased flexibility for searching for libraries and
# support multi-isa target systems.
Expand All @@ -24,7 +24,7 @@
#
AC_PREREQ(2.60)
#m4_include([m4/version.m4])
AC_INIT(libmembase, VERSION_NUMBER, trond.norbye@gmail.com)
AC_INIT(libcouchbase, VERSION_NUMBER, trond.norbye@gmail.com)
AC_CONFIG_SRCDIR([src/internal.h])
AC_CONFIG_AUX_DIR(config)

Expand Down Expand Up @@ -69,7 +69,7 @@ AH_TOP([
#define CONFIG_H
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2010 Membase, Inc.
* Copyright 2010 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
34 changes: 17 additions & 17 deletions example/memcat.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2010 Membase, Inc.
* Copyright 2010 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

/**
* Example program using libmembase_mget.
* Example program using libcouchbase_mget.
*
* @author Trond Norbye
* @todo add documentation
Expand All @@ -33,7 +33,7 @@
#include <assert.h>
#include <event.h>

#include <libmembase/membase.h>
#include <libcouchbase/couchbase.h>

static void usage(char cmd, const void *arg, void *cookie);
static void set_char_ptr(char cmd, const void *arg, void *cookie) {
Expand Down Expand Up @@ -163,15 +163,15 @@ static void handle_options(int argc, char **argv) {

FILE *output;

static void get_callback(libmembase_t instance,
libmembase_error_t error,
static void get_callback(libcouchbase_t instance,
libcouchbase_error_t error,
const void *key, size_t nkey,
const void *bytes, size_t nbytes,
uint32_t flags, uint64_t cas)
{
(void)instance;
(void)bytes;
fprintf(output, "%s <", error == LIBMEMBASE_SUCCESS ? "Found" : "Missing");
fprintf(output, "%s <", error == LIBCOUCHBASE_SUCCESS ? "Found" : "Missing");
fwrite(key, nkey, 1, output);
fprintf(output, "> size: %zu flags %04x cas: %"PRIu64"\n",
nbytes, flags, cas);
Expand Down Expand Up @@ -202,31 +202,31 @@ int main(int argc, char **argv)
}

struct event_base *evbase = event_init();
libmembase_t instance = libmembase_create(host, username,
passwd, bucket, evbase);
libcouchbase_t instance = libcouchbase_create(host, username,
passwd, bucket, evbase);
if (instance == NULL) {
fprintf(stderr, "Failed to create libmembase instance\n");
fprintf(stderr, "Failed to create libcouchbase instance\n");
return 1;
}

if (libmembase_connect(instance) != LIBMEMBASE_SUCCESS) {
fprintf(stderr, "Failed to connect libmembase instance to server\n");
if (libcouchbase_connect(instance) != LIBCOUCHBASE_SUCCESS) {
fprintf(stderr, "Failed to connect libcouchbase instance to server\n");
return 1;
}

libmembase_callback_t callbacks = {
libcouchbase_callback_t callbacks = {
.get = get_callback
};
libmembase_set_callbacks(instance, &callbacks);
libcouchbase_set_callbacks(instance, &callbacks);

if (libmembase_mget(instance, jj,
(const void * const *)keys,
nkey) != LIBMEMBASE_SUCCESS) {
if (libcouchbase_mget(instance, jj,
(const void * const *)keys,
nkey) != LIBCOUCHBASE_SUCCESS) {
fprintf(stderr, "Failed to send requests\n");
return 1;
}

libmembase_execute(instance);
libcouchbase_execute(instance);
free(keys);
free(nkey);

Expand Down
40 changes: 20 additions & 20 deletions example/memcp.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2010 Membase, Inc.
* Copyright 2010 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

/**
* Example program using libmembase_storage.
* Example program using libcouchbase_storage.
*
* @author Trond Norbye
* @todo add documentation
Expand All @@ -36,7 +36,7 @@
#include <assert.h>
#include <sys/mman.h>
#include <event.h>
#include <libmembase/membase.h>
#include <libcouchbase/couchbase.h>

static void usage(char cmd, const void *arg, void *cookie);
static void set_char_ptr(char cmd, const void *arg, void *cookie) {
Expand Down Expand Up @@ -166,14 +166,14 @@ static void handle_options(int argc, char **argv) {

FILE *output;

static void storage_callback(libmembase_t instance,
libmembase_error_t error,
static void storage_callback(libcouchbase_t instance,
libcouchbase_error_t error,
const void *key, size_t nkey,
uint64_t cas)
{
(void)instance;
fprintf(output, "%sstore <",
error == LIBMEMBASE_SUCCESS ? "" : "Failed to ");
error == LIBCOUCHBASE_SUCCESS ? "" : "Failed to ");
fwrite(key, nkey, 1, output);
fprintf(output, "> cas: %"PRIu64"\n", cas);
}
Expand All @@ -194,22 +194,22 @@ int main(int argc, char **argv)
}

struct event_base *evbase = event_init();
libmembase_t instance = libmembase_create(host, username,
passwd, bucket, evbase);
libcouchbase_t instance = libcouchbase_create(host, username,
passwd, bucket, evbase);
if (instance == NULL) {
fprintf(stderr, "Failed to create libmembase instance\n");
fprintf(stderr, "Failed to create libcouchbase instance\n");
return 1;
}

if (libmembase_connect(instance) != LIBMEMBASE_SUCCESS) {
fprintf(stderr, "Failed to connect libmembase instance to server\n");
if (libcouchbase_connect(instance) != LIBCOUCHBASE_SUCCESS) {
fprintf(stderr, "Failed to connect libcouchbase instance to server\n");
return 1;
}

libmembase_callback_t callbacks = {
libcouchbase_callback_t callbacks = {
.storage = storage_callback
};
libmembase_set_callbacks(instance, &callbacks);
libcouchbase_set_callbacks(instance, &callbacks);

for (int ii = optind; ii < argc; ++ii) {
const char *key = argv[ii];
Expand All @@ -221,13 +221,13 @@ int main(int argc, char **argv)
void *bytes = mmap(NULL, (size_t)st.st_size, PROT_READ,
MAP_NORESERVE | MAP_PRIVATE, fileno(fp), 0);
if (bytes != NULL) {
libmembase_error_t err;
err = libmembase_store(instance,
LIBMEMBASE_SET,
key, nkey,
bytes, (size_t)st.st_size,
0, 0, 0);
libmembase_execute(instance);
libcouchbase_error_t err;
err = libcouchbase_store(instance,
LIBCOUCHBASE_SET,
key, nkey,
bytes, (size_t)st.st_size,
0, 0, 0);
libcouchbase_execute(instance);
munmap(bytes, (size_t)st.st_size);
fclose(fp);
} else {
Expand Down
24 changes: 12 additions & 12 deletions example/memdump.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2010 Membase, Inc.
* Copyright 2010 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

/**
* Example program using libmembase_tap_cluster.
* Example program using libcouchbase_tap_cluster.
*
* @author Trond Norbye
* @todo add documentation
Expand All @@ -31,7 +31,7 @@
#include <string.h>
#include <event.h>

#include <libmembase/membase.h>
#include <libcouchbase/couchbase.h>

static void usage(char cmd, const void *arg, void *cookie);
static void set_char_ptr(char cmd, const void *arg, void *cookie) {
Expand Down Expand Up @@ -161,7 +161,7 @@ static void handle_options(int argc, char **argv) {

FILE *output;

static void tap_mutation(libmembase_t instance,
static void tap_mutation(libcouchbase_t instance,
const void *key,
size_t nkey,
const void *data,
Expand Down Expand Up @@ -198,23 +198,23 @@ int main(int argc, char **argv)

struct event_base *evbase = event_init();

libmembase_t instance = libmembase_create(host, username,
passwd, bucket, evbase);
libcouchbase_t instance = libcouchbase_create(host, username,
passwd, bucket, evbase);
if (instance == NULL) {
fprintf(stderr, "Failed to create libmembase instance\n");
fprintf(stderr, "Failed to create libcouchbase instance\n");
return 1;
}

if (libmembase_connect(instance) != LIBMEMBASE_SUCCESS) {
fprintf(stderr, "Failed to connect libmembase instance to server\n");
if (libcouchbase_connect(instance) != LIBCOUCHBASE_SUCCESS) {
fprintf(stderr, "Failed to connect libcouchbase instance to server\n");
return 1;
}

libmembase_callback_t callbacks = {
libcouchbase_callback_t callbacks = {
.tap_mutation = tap_mutation,
};
libmembase_set_callbacks(instance, &callbacks);
libmembase_tap_cluster(instance, NULL, true);
libcouchbase_set_callbacks(instance, &callbacks);
libcouchbase_tap_cluster(instance, NULL, true);

return 0;
}
Expand Down

0 comments on commit d356243

Please sign in to comment.