kvstore/*.pb.cc
kvstore/*.pb.h
kvstore/lib*.a
+kvstore/lib*.so
kvstore/kvstore
microbench/bench
microbench/readbench
-include_directories("${LIBS3_BUILD_DIR}/include")
-link_directories("${LIBS3_BUILD_DIR}/lib")
+set(KVSTORE_DIR "${CMAKE_SOURCE_DIR}/kvstore")
+include_directories("${LIBS3_BUILD_DIR}/include" ${KVSTORE_DIR})
+link_directories("${LIBS3_BUILD_DIR}/lib" ${KVSTORE_DIR})
add_library(bluesky SHARED
cache.c crypto.c debug.c dir.c file.c init.c inode.c serialize.c
- store.c s3store.c util.c)
+ store.c store-kv.cc s3store.c util.c)
add_executable(bluesky-test main.c)
set(CMAKE_C_FLAGS "-Wall -std=gnu99 ${CMAKE_C_FLAGS}")
set(INSTALL_RPATH_USE_LINK_PATH 1)
include_directories(${GLIB_INCLUDE_DIRS})
-target_link_libraries(bluesky ${GLIB_LIBRARIES} gcrypt s3)
+target_link_libraries(bluesky ${GLIB_LIBRARIES} gcrypt s3 kvclient)
target_link_libraries(bluesky-test bluesky ${GLIB_LIBRARIES})
#set_target_properties(bluesky PROPERTIES LINK_INTERFACE_LIBRARIES "")
/* BlueSky library initialization. */
void bluesky_store_init_s3(void);
+void bluesky_store_init_kv(void);
/* Initialize the BlueSky library and dependent libraries. */
void bluesky_init(void)
}
bluesky_store_init();
+ bluesky_store_init_kv();
bluesky_store_init_s3();
}
--- /dev/null
+/* Blue Sky: File Systems in the Cloud
+ *
+ * Copyright (C) 2009 The Regents of the University of California
+ * Written by Michael Vrable <mvrable@cs.ucsd.edu>
+ *
+ * TODO: Licensing
+ */
+
+/* Interface to John McCullough's simple key/value store. */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <string.h>
+
+#include "bluesky-private.h"
+#include "kvservice.h"
+#include "kvclient.h"
+
+using namespace boost;
+using namespace kvstore;
+using namespace std;
+
+static gpointer kvstore_new()
+{
+ KeyValueClient *client = new KeyValueClient("127.0.0.1", "9090");
+ return client;
+}
+
+static void kvstore_destroy(gpointer store)
+{
+ KeyValueClient *client = (KeyValueClient *)store;
+ delete client;
+}
+
+static void kvstore_submit(gpointer store, BlueSkyStoreAsync *async)
+{
+ KeyValueClient *client = (KeyValueClient *)store;
+
+ g_return_if_fail(async->status == ASYNC_NEW);
+ g_return_if_fail(async->op != STORE_OP_NONE);
+
+ switch (async->op) {
+ case STORE_OP_GET:
+ {
+ string value;
+ if (client->Get(async->key, &value)) {
+ async->data = bluesky_string_new(g_memdup(value.c_str(),
+ value.length()),
+ value.length());
+ async->result = 0;
+ }
+ break;
+ }
+
+ case STORE_OP_PUT:
+ {
+ string value(async->data->data, async->data->len);
+ client->Put(async->key, value);
+ break;
+ }
+
+ default:
+ g_warning("Uknown operation type for MemStore: %d\n", async->op);
+ return;
+ }
+
+ bluesky_store_async_mark_complete(async);
+}
+
+static void kvstore_cleanup(gpointer store, BlueSkyStoreAsync *async)
+{
+ KeyValueClient *client = (KeyValueClient *)store;
+}
+
+static BlueSkyStoreImplementation store_impl = {
+ kvstore_new,
+ kvstore_destroy,
+ kvstore_submit,
+ kvstore_cleanup,
+};
+
+extern "C" void bluesky_store_init_kv(void)
+{
+ bluesky_store_register(&store_impl, "kv");
+}
cmake_minimum_required(VERSION 2.6)
+set(CMAKE_BUILD_TYPE Debug)
-add_custom_command(OUTPUT kvstore.pb.cc kvstore.pb.h
- COMMAND protoc --cpp_out=. kvstore.proto
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kvstore.pb.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/kvstore.pb.h
+ COMMAND protoc --cpp_out=${CMAKE_CURRENT_BINARY_DIR}
+ --proto_path=${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/kvstore.proto
DEPENDS kvstore.proto)
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
add_library(protobufrpc protobufrpc.cc socket_pool.cc workqueue.cc)
-add_library(kvservice kvservice.cc kvstore.pb.cc backend.cc)
-add_library(kvclient kvclient.cc)
+add_library(kvservice kvservice.cc backend.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/kvstore.pb.cc)
+
add_executable(kvstore kvstore.cc)
+add_library(kvclient SHARED
+ kvclient.cc kvservice.cc backend.cc kvstore.pb.cc
+ protobufrpc.cc socket_pool.cc workqueue.cc)
+target_link_libraries(kvclient
+ boost_thread-mt boost_regex-mt boost_system-mt
+ boost_program_options-mt db protobuf pthread)
+
target_link_libraries(kvstore
kvservice
boost_thread-mt boost_regex-mt boost_system-mt
-include_directories("${LIBS3_BUILD_DIR}/include")
-link_directories("${LIBS3_BUILD_DIR}/lib")
+set(KVSTORE_DIR "${CMAKE_SOURCE_DIR}/kvstore")
+include_directories("${LIBS3_BUILD_DIR}/include" ${KVSTORE_DIR})
+link_directories("${LIBS3_BUILD_DIR}/lib" ${KVSTORE_DIR})
add_executable(nfsproxy
common.c nfsd.c rpc.c mount.c nfs3.c