Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Changes: #16

Open
wants to merge 1 commit into from

2 participants

@chetmurthy

(1) added some command-line args for the mysql backend, to specify
host, user, pass, database

(2) build options for specifying leveldb, snappy, bdb, etc

(3) added a "metadata" method that returns server metadata to the
client. THis was in order to change the sample client so that it
wouldn't fail on leveldb (which always returns success on deletes)

@chetmurthy chetmurthy Changes:
(1) added some command-line args for the mysql backend, to specify
host, user, pass, database

(2) build options for specifying leveldb, snappy, bdb, etc

(3) added a "metadata" method that returns server metadata to the
client.  THis was in order to change the sample client so that it
wouldn't fail on leveldb (which always returns success on deletes)
54a0853
@m1ch1

These variables shouldn't refer to /home/chet. Instead, the default values should correspond to the build instructions:

https://github.com/m1ch1/mapkeeper/blob/master/bdb/README.md
https://github.com/m1ch1/mapkeeper/blob/master/kyotocabinet/README.md
https://github.com/m1ch1/mapkeeper/blob/master/mysql/README.md

I'd rather not include MAVEN_DIR, and leave it up to the users to set PATH correctly.

What's snappy?

@m1ch1

It's probably better not to include the versions, since the specific version might not be available on the host system.

@m1ch1
Owner

Did you need this header to compile?

@m1ch1

Looks like this block is indented incorrectly.

@m1ch1

Some headers are included twice.

@m1ch1

We can probably delete this line.

@m1ch1

Indentation?

@m1ch1

Indentation?

@m1ch1

Do we need this change?

@m1ch1

Indentation?

@m1ch1

We don't need to check for verbose flag here.

@m1ch1

I prefer the name getMetadata() to be consistent with other methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 19, 2012
  1. @chetmurthy

    Changes:

    chetmurthy authored
    (1) added some command-line args for the mysql backend, to specify
    host, user, pass, database
    
    (2) build options for specifying leveldb, snappy, bdb, etc
    
    (3) added a "metadata" method that returns server metadata to the
    client.  THis was in order to change the sample client so that it
    wouldn't fail on leveldb (which always returns success on deletes)
This page is out of date. Refresh to see the latest.
View
14 Makefile.config
@@ -1,3 +1,13 @@
-THRIFT_DIR=/usr/local
-
+THRIFT_DIR=/home/chet/Hack/Thrift
+LEVELDB_DIR=/home/chet/Hack/Leveldb/src/leveldb
+SNAPPY_DIR=/home/chet/Hack/Leveldb
+BDB_DIR=/home/chet/Hack/YCSB
+MYSQL_DIR=/usr
+MAVEN_DIR=/home/chet/Hack/Maven/apache-maven-3.0.4
+KC_DIR=/home/chet/Hack/Leveldb
+CC=gcc-4.4
+CXX=g++-4.4
+DEBUG=-g
+CXXFLAGS = $(DEBUG) -Wall -I $(THRIFT_DIR)/include/thrift -I $(THRIFT_DIR)/include -I ../thrift/gen-cpp
+LDFLAGS = -L$(THRIFT_DIR)/lib -lthrift -L../thrift/gen-cpp -lmapkeeper
View
1  bdb/Bdb.h
@@ -16,6 +16,7 @@
#ifndef BDB_H
#define BDB_H
+#include <string.h>
#include <db_cxx.h>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
View
6 bdb/BdbServerHandler.cpp
@@ -152,6 +152,12 @@ ping()
return ResponseCode::Success;
}
+void BdbServerHandler::
+metadata(MetaData& _return) {
+ _return.responseCode = ResponseCode::Success ;
+ _return.implType = "bdb" ;
+ }
+
ResponseCode::type BdbServerHandler::
addMap(const std::string& mapName)
{
View
1  bdb/BdbServerHandler.h
@@ -40,6 +40,7 @@ class BdbServerHandler : virtual public MapKeeperIf {
uint32_t keyBufferSizeBytes, uint32_t valueBufferSizeBytes,
uint32_t checkpointFrequencyMs, uint32_t checkpointMinChangeKb);
ResponseCode::type ping();
+ void metadata(MetaData& _return);
ResponseCode::type addMap(const std::string& databaseName);
ResponseCode::type dropMap(const std::string& databaseName);
void listMaps(StringListResponse& _return);
View
11 bdb/Makefile
@@ -1,15 +1,18 @@
+include ../Makefile.config
+CXXFLAGS += -I$(BDB_DIR)/include
+LDFLAGS += -levent -lboost_thread -L$(BDB_DIR)/lib -ldb_cxx
+
EXECUTABLE = mapkeeper_bdb
all :
- g++ -Wall -o $(EXECUTABLE) *cpp -I /usr/local/include/thrift -L/usr/local/lib -lthrift \
- -I ../thrift/gen-cpp -L../thrift/gen-cpp -lmapkeeper -levent -lboost_thread -ldb_cxx
+ $(CXX) $(CXXFLAGS) -o $(EXECUTABLE) *cpp $(LDFLAGS)
thrift:
make -C ../thrift
run :
- LD_LIBRARY_PATH=/usr/local/lib:../thrift/gen-cpp ./$(EXECUTABLE)
+ LD_LIBRARY_PATH=$(THRIFT_DIR)/lib:../thrift/gen-cpp:$(BDB_DIR)/lib:$(LD_LIBRARY_PATH) ./$(EXECUTABLE)
clean :
- - rm $(EXECUTABLE) *o
+ - rm -f $(EXECUTABLE) *o
wipe:
- find data/ -type f |grep -v DB_CONFIG | xargs rm -f
View
9 client/Makefile
@@ -1,11 +1,14 @@
+include ../Makefile.config
+CXXFLAGS +=
+
EXECUTABLE = mapkeeper_client
all : thrift
- g++ -o $(EXECUTABLE) *cpp -I /usr/local/include/thrift -L /usr/local/lib -lthrift -I ../thrift/gen-cpp -L ../thrift/gen-cpp -lmapkeeper
+ $(CXX) $(CXXFLAGS) -o $(EXECUTABLE) *cpp $(LDFLAGS)
thrift:
make -C ../thrift
run :
- LD_LIBRARY_PATH=/usr/local/lib:../thrift/gen-cpp ./$(EXECUTABLE)
+ LD_LIBRARY_PATH=$(THRIFT_DIR)/lib:../thrift/gen-cpp:$(LD_LIBRARY_PATH) ./$(EXECUTABLE)
clean :
- - rm $(THRIFT_SRC) $(EXECUTABLE) *o
+ - rm -f $(THRIFT_SRC) $(EXECUTABLE) *o
View
15 client/SampleClient.cpp
@@ -181,8 +181,19 @@ int main(int argc, char **argv) {
// test remove
assert(mapkeeper::ResponseCode::Success == client.remove("db1", "k1"));
- assert(mapkeeper::ResponseCode::RecordNotFound== client.remove("db1", "k1"));
- assert(mapkeeper::ResponseCode::RecordNotFound== client.remove("db1", "k2"));
+ {
+ mapkeeper::MetaData md ;
+ client.metadata(md) ;
+ assert (mapkeeper::ResponseCode::Success== md.responseCode) ;
+ if (md.implType == "leveldb") {
+ assert(mapkeeper::ResponseCode::Success== client.remove("db1", "k1"));
+ assert(mapkeeper::ResponseCode::Success== client.remove("db1", "k2"));
+ }
+ else {
+ assert(mapkeeper::ResponseCode::RecordNotFound== client.remove("db1", "k1"));
+ assert(mapkeeper::ResponseCode::RecordNotFound== client.remove("db1", "k2"));
+ }
+ }
assert(mapkeeper::ResponseCode::MapNotFound == client.remove("db2", "k1"));
// test listMaps and dropMap
View
10 handlersocket/Makefile
@@ -1,16 +1,16 @@
EXECUTABLE = mapkeeper_handlersocket
all :
- g++ -g -Wall -O2 -o $(EXECUTABLE) *cpp -I /usr/local/include/thrift -L /usr/local/lib -lthrift \
- -I /usr/local/mysql/include -lthrift -I /usr/local/include/handlersocket -lhsclient -lboost_thread \
- -L /usr/local/mysql/lib -lmysqlclient -I ../thrift/gen-cpp -L ../thrift/gen-cpp -lmapkeeper
+ $(CXX) $(CXXFLAGS) -g -Wall -O2 -o $(EXECUTABLE) *cpp -I $(THRIFT_DIR)/include/thrift -L $(THRIFT_DIR)/lib -lthrift \
+ -I $(MYSQL_DIR)/include -lthrift -I $(HS_DIR)/include/handlersocket -lhsclient -lboost_thread \
+ -L $(MYSQL_DIR)/lib -lmysqlclient -I ../thrift/gen-cpp -L ../thrift/gen-cpp -lmapkeeper
thrift:
make -C ../thrift
run :
- LD_LIBRARY_PATH=/usr/local/mysql/lib:/usr/local/lib:../thrift/gen-cpp ./$(EXECUTABLE)
+ LD_LIBRARY_PATH=$(MYSQL_DIR)/lib:$(THRIFT_DIR)/lib:../thrift/gen-cpp:$(LD_LIBRARY_PATH) ./$(EXECUTABLE)
clean :
- - rm $(EXECUTABLE) *o
+ - rm -f $(EXECUTABLE) *o
wipe :
- mysql -uroot -e "drop database if exists mapkeeper"
View
5 kyotocabinet/KyotoCabinetServer.cpp
@@ -91,6 +91,11 @@ class KyotoCabinetServer: virtual public MapKeeperIf {
return ResponseCode::Success;
}
+ void metadata(MetaData& _return) {
+ _return.responseCode = ResponseCode::Success ;
+ _return.implType = "kyotocabinet" ;
+ }
+
ResponseCode::type addMap(const std::string& mapName) {
boost::unique_lock< boost::shared_mutex> writeLock(mutex_);;
boost::ptr_map<std::string, TreeDB>::iterator itr = maps_.find(mapName);
View
7 kyotocabinet/Makefile
@@ -1,11 +1,12 @@
include ../Makefile.config
+CXXFLAGS += -I$(KC_DIR)/include
+LDFLAGS += -L $(KC_DIR)/lib -l kyotocabinet
EXECUTABLE = mapkeeper_kyotocabinet
all :
- g++ -Wall -o $(EXECUTABLE) *cpp -I $(THRIFT_DIR)/include/thrift -I $(THRIFT_DIR)/include \
- -lboost_thread -lboost_filesystem -lboost_program_options -lthrift -I ../thrift/gen-cpp \
- -L $(THRIFT_DIR)/lib -l kyotocabinet -L ../thrift/gen-cpp -lmapkeeper \
+ $(CXX) $(CXXFLAGS) -o $(EXECUTABLE) *cpp \
+ $(LDFLAGS) -lboost_thread -lboost_filesystem -lboost_program_options \
-Wl,-rpath,\$$ORIGIN/../thrift/gen-cpp -Wl,-rpath,$(THRIFT_DIR)/lib
run: all
View
5 leveldb/LevelDbServer.cpp
@@ -90,6 +90,11 @@ class LevelDbServer: virtual public MapKeeperIf {
return ResponseCode::Success;
}
+ void metadata(MetaData& _return) {
+ _return.responseCode = ResponseCode::Success ;
+ _return.implType = "leveldb" ;
+ }
+
ResponseCode::type addMap(const std::string& mapName) {
leveldb::DB* db;
leveldb::Options options;
View
8 leveldb/Makefile
@@ -1,12 +1,12 @@
include ../Makefile.config
+CXXFLAGS += -I$(LEVELDB_DIR)/include
+LDFLAGS += -L$(LEVELDB_DIR) -lleveldb -L$(SNAPPY_DIR)/lib -lsnappy
EXECUTABLE = mapkeeper_leveldb
all :
- g++ -Wall -o $(EXECUTABLE) *cpp -I $(THRIFT_DIR)/include/thrift -I $(THRIFT_DIR)/include \
- -lboost_thread -lboost_filesystem -lboost_program_options -lthrift -lleveldb -I ../thrift/gen-cpp \
- -L $(THRIFT_DIR)/lib \
- -L ../thrift/gen-cpp -lmapkeeper \
+ $(CXX) $(CXXFLAGS) -o $(EXECUTABLE) *cpp $(LDFLAGS) \
+ -lboost_thread -lboost_filesystem -lboost_program_options \
-Wl,-rpath,\$$ORIGIN/../thrift/gen-cpp \
-Wl,-rpath,$(THRIFT_DIR)/lib
View
7 mysql/Makefile
@@ -1,11 +1,12 @@
include ../Makefile.config
+CXXFLAGS += -I $(MYSQL_DIR)/include/mysql
+LDFLAGS += -L $(MYSQL_DIR)/lib -lmysqlclient
EXECUTABLE = mapkeeper_mysql
all :
- g++ -Wall -o $(EXECUTABLE) *cpp -I $(THRIFT_DIR)/include/thrift -I $(THRIFT_DIR)/include -L$(THRIFT_DIR)/lib \
- -I /usr/local/mysql/include -I /usr/include/mysql -lboost_thread -lthrift \
- -L/usr/local/mysql/lib -lmysqlclient -I ../thrift/gen-cpp -L../thrift/gen-cpp -lmapkeeper \
+ $(CXX) $(CXXFLAGS) -o $(EXECUTABLE) *cpp $(LDFLAGS) \
+ -lboost_thread -lboost_program_options \
-Wl,-rpath,\$$ORIGIN/../thrift/gen-cpp -Wl,-rpath,$(THRIFT_DIR)/lib
run: all
View
80 mysql/MySqlServer.cpp
@@ -17,6 +17,8 @@
/**
* This is a implementation of the mapkeeper interface that uses mysql.
*/
+#include <cstdio>
+#include <iostream>
#include <mysql.h>
#include <mysqld_error.h>
#include <arpa/inet.h>
@@ -29,6 +31,19 @@
#include <transport/TServerSocket.h>
#include <transport/TBufferTransports.h>
+#include "boost/format.hpp"
+#include <boost/program_options.hpp>
+using boost::format;
+namespace po = boost::program_options;
+
+using namespace std;
+using boost::shared_ptr;
+
+#include "boost/format.hpp"
+#include <boost/program_options.hpp>
+using boost::format;
+namespace po = boost::program_options;
+
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace mapkeeper;
@@ -36,8 +51,12 @@ using boost::shared_ptr;
class MySqlServer: virtual public MapKeeperIf {
public:
- MySqlServer(const std::string& host, uint32_t port) :
+ MySqlServer(const std::string& host, const std::string& user, const std::string& pass, const std::string& database, uint32_t port, bool verbose) :
host_(host),
+ user_(user),
+ pass_(pass),
+ database_(database),
+ verbose_(verbose),
port_(port),
mysql_(new boost::thread_specific_ptr<MYSQL>(destroyMySql)) {
}
@@ -47,10 +66,17 @@ class MySqlServer: virtual public MapKeeperIf {
}
ResponseCode::type ping() {
+ if (verbose_) cout <<"ping()"<<endl<<flush ;
return ResponseCode::Success;
}
+ void metadata(MetaData& _return) {
+ _return.responseCode = ResponseCode::Success ;
+ _return.implType = "mysql" ;
+ }
+
ResponseCode::type addMap(const std::string& mapName) {
+ if (verbose_) cout<<"addMap("<<mapName<<")"<<endl<<flush;
initMySql();
std::string query = "create table " + escapeString(mapName) +
"(record_key varbinary(512) primary key, record_value longblob not null) engine=innodb";
@@ -68,6 +94,7 @@ class MySqlServer: virtual public MapKeeperIf {
}
ResponseCode::type dropMap(const std::string& mapName) {
+ if (verbose_) cout<<"dropMap("<<mapName<<")"<<endl<<flush;
initMySql();
std::string query = "drop table " + escapeString(mapName);
int result = mysql_real_query(mysql_->get(), query.c_str(), query.length());
@@ -99,7 +126,7 @@ class MySqlServer: virtual public MapKeeperIf {
MYSQL_ROW row;
while ((row = mysql_fetch_row(res))) {
- uint64_t* lengths = mysql_fetch_lengths(res);
+ long unsigned int* lengths = mysql_fetch_lengths(res);
_return.values.push_back(std::string(row[0], lengths[0]));
}
mysql_free_result(res);
@@ -143,7 +170,7 @@ class MySqlServer: virtual public MapKeeperIf {
int32_t numBytes = 0;
while ((row = mysql_fetch_row(res))) {
- uint64_t* lengths = mysql_fetch_lengths(res);
+ long unsigned int* lengths = mysql_fetch_lengths(res);
mapkeeper::Record record;
record.key = std::string(row[0], lengths[0]);
record.value = std::string(row[1], lengths[1]);
@@ -189,7 +216,7 @@ class MySqlServer: virtual public MapKeeperIf {
return;
}
MYSQL_ROW row = mysql_fetch_row(res);
- uint64_t* lengths = mysql_fetch_lengths(res);
+ long unsigned int* lengths = mysql_fetch_lengths(res);
assert(row);
_return.value = std::string(row[0], lengths[0]);
mysql_free_result(res);
@@ -292,9 +319,9 @@ class MySqlServer: virtual public MapKeeperIf {
assert(mysql_->get() == mysql_real_connect(mysql_->get(),
host_.c_str(), // hostname
- "root", // user
- NULL, // password
- NULL, // default database
+ user_.c_str(), // user
+ pass_.c_str(), // password
+ database_.c_str(), // default database
port_, // port
NULL, // unix socket
0 // flags
@@ -311,13 +338,48 @@ class MySqlServer: virtual public MapKeeperIf {
}
std::string host_;
+ std::string user_;
+ std::string pass_;
+ std::string database_;
uint32_t port_;
+ bool verbose_ ;
boost::thread_specific_ptr<MYSQL>* mysql_;
};
int main(int argc, char **argv) {
- int port = 9090;
- shared_ptr<MySqlServer> handler(new MySqlServer("localhost", 3306));
+
+ po::options_description desc("Allowed options");
+
+ bool verbose ;
+
+ int port ;
+ int mysql_port;
+ std::string host;
+ std::string user;
+ std::string pass;
+ std::string database;
+
+ desc.add_options()
+ ("help", "produce help message")
+ ("port", po::value<int>(&port)->default_value(9090), "mapkeeper port")
+ ("msyql-port", po::value<int>(&mysql_port)->default_value(3306), "mysql port")
+ ("host,h", po::value<std::string>(&host)->default_value("localhost"), "mysql host")
+ ("user,u", po::value<std::string>(&user)->default_value("root"), "mysql user")
+ ("pass,p", po::value<std::string>(&pass)->default_value(""), "mysql password")
+ ("database", po::value<std::string>(&database)->default_value("mapkeeper"), "mysql database")
+ ("verbose,v", po::bool_switch(&verbose), "verbose output")
+ ;
+
+ po::variables_map vm;
+ po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::notify(vm);
+
+ if (vm.count("help")) {
+ if (verbose) cout << desc << std::endl ;
+ exit(-1) ;
+ }
+
+ shared_ptr<MySqlServer> handler(new MySqlServer(host, user, pass, database, mysql_port, verbose));
shared_ptr<TProcessor> processor(new MapKeeperProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
View
11 stlmap/Makefile
@@ -1,12 +1,15 @@
+include ../Makefile.config
+LDFLAGS += -lthriftnb
+
EXECUTABLE = mapkeeper_stlmap
all :
- g++ -Wall -o $(EXECUTABLE) *cpp -I /usr/local/include/thrift -L/usr/local/lib -lthrift -lthriftnb \
- -I ../thrift/gen-cpp -L../thrift/gen-cpp -lmapkeeper -levent -lboost_thread
+ $(CXX) $(CXXFLAGS) -o $(EXECUTABLE) *cpp $(LDFLAGS) \
+ -levent -lboost_thread -lboost_program_options
thrift:
make -C ../thrift
run :
- LD_LIBRARY_PATH=/usr/local/lib:../thrift/gen-cpp ./$(EXECUTABLE)
+ LD_LIBRARY_PATH=$(THRIFT_DIR)/lib:../thrift/gen-cpp:$(LD_LIBRARY_PATH) ./$(EXECUTABLE)
clean :
- - rm $(EXECUTABLE) *o
+ - rm -f $(EXECUTABLE) *o
View
37 stlmap/StlMapServer.cpp
@@ -35,13 +35,24 @@ using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
+#include "boost/format.hpp"
+#include <boost/program_options.hpp>
+using boost::format;
+namespace po = boost::program_options;
class StlMapServer: virtual public MapKeeperIf {
public:
+ StlMapServer(bool verbose) : verbose_(verbose) {
+ }
ResponseCode::type ping() {
return ResponseCode::Success;
}
+ void metadata(MetaData& _return) {
+ _return.responseCode = ResponseCode::Success ;
+ _return.implType = "stlmap" ;
+ }
+
ResponseCode::type addMap(const string& mapName) {
boost::unique_lock< boost::shared_mutex > writeLock(mutex_);;
map<string, map<string, string> >::iterator itr = maps_.find(mapName);
@@ -220,13 +231,35 @@ class StlMapServer: virtual public MapKeeperIf {
}
private:
+ bool verbose_ ;
map<string, map<string, string> > maps_;
boost::shared_mutex mutex_; // protect map_
};
int main(int argc, char **argv) {
- int port = 9090;
- shared_ptr<StlMapServer> handler(new StlMapServer());
+
+ po::options_description desc("Allowed options");
+
+ bool verbose ;
+
+ desc.add_options()
+ ("help", "produce help message")
+ ("port", po::value<int>()->default_value(9090), "mapkeeper port")
+ ("verbose,v", po::bool_switch(&verbose), "verbose output")
+ ;
+
+ po::variables_map vm;
+ po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::notify(vm);
+
+ if (vm.count("help")) {
+ std::cout << desc << std::endl ;
+ exit(-1) ;
+ }
+
+ int port = vm["port"].as<int>() ;
+
+ shared_ptr<StlMapServer> handler(new StlMapServer(verbose));
shared_ptr<TProcessor> processor(new MapKeeperProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
View
8 stubcpp/Makefile
@@ -1,3 +1,5 @@
+include ../Makefile.config
+
#
# $ make run mode=threaded # run TThreadedServer
# $ make run mode=threadpool # run TThreadPoolServer
@@ -6,12 +8,12 @@
EXECUTABLE = mapkeeper_stubcpp
all :
- g++ -Wall -O2 -o $(EXECUTABLE) *cpp -I /usr/local/include/thrift -L/usr/local/lib -lthrift -lthriftnb \
+ $(CXX) -Wall -O2 -o $(EXECUTABLE) *cpp -I $(THRIFT_DIR)/include/thrift -L $(THRIFT_DIR)/lib -lthrift -lthriftnb \
-I ../thrift/gen-cpp -L../thrift/gen-cpp -lmapkeeper -levent
thrift:
make -C ../thrift
run :
- LD_LIBRARY_PATH=/usr/local/lib:../thrift/gen-cpp ./$(EXECUTABLE) $(mode)
+ LD_LIBRARY_PATH=$(THRIFT_DIR)/lib:../thrift/gen-cpp:$(LD_LIBRARY_PATH) ./$(EXECUTABLE) $(mode)
clean :
- - rm $(EXECUTABLE) *o
+ - rm -f $(EXECUTABLE) *o
View
4 stubcpp/StubServer.cpp
@@ -27,8 +27,8 @@
#include <server/TThreadedServer.h>
#include <transport/TServerSocket.h>
#include <transport/TBufferTransports.h>
-#include <thrift/concurrency/ThreadManager.h>
-#include <thrift/concurrency/PosixThreadFactory.h>
+#include <concurrency/ThreadManager.h>
+#include <concurrency/PosixThreadFactory.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
View
4 thrift/Makefile
@@ -3,8 +3,8 @@ include ../Makefile.config
all:
$(THRIFT_DIR)/bin/thrift --gen cpp mapkeeper.thrift
make -C gen-cpp
- cd gen-java && mvn clean package
+ cd gen-java && $(MAVEN_DIR)/bin/mvn -Dthrift.dir=$(THRIFT_DIR) clean package
clean:
make -C gen-cpp clean
- cd gen-java && mvn clean
+ cd gen-java && $(MAVEN_DIR)/bin/mvn clean
View
8 thrift/gen-cpp/Makefile
@@ -1,8 +1,5 @@
include ../../Makefile.config
-CC=g++
-CFLAGS=-c -Wall -I $(THRIFT_DIR)/include/thrift -I $(THRIFT_DIR)/include
-LDFLAGS = -L$(THRIFT_DIR)/lib -lthrift
SOURCES = mapkeeper_constants.cpp \
MapKeeper.cpp \
mapkeeper_types.cpp \
@@ -14,13 +11,14 @@ A = libmapkeeper.a
all: $(SOURCES) $(LIB) $(A)
$(LIB): $(OBJECTS)
- $(CC) -shared -Wl,-soname,$@ -o $@ $^
+ $(CXX) -shared -Wl,-soname,$@ -o $@ $^
$(A): $(OBJECTS)
cp $(THRIFT_DIR)/lib/libthrift.a $@
ar rs $@ $^
%.o : %.cpp
- $(CC) $(CFLAGS) -fPIC -c -o $@ $^
+ $(CXX) $(CXXFLAGS) -fPIC -c -o $@ $^
+
#.cpp.o:
clean:
View
2  thrift/gen-java/pom.xml
@@ -60,7 +60,7 @@
<configuration>
<tasks>
<mkdir dir="target/generated-sources/thrift" />
- <exec executable="/usr/local/bin/thrift">
+ <exec executable="${thrift.dir}/bin/thrift">
<arg value="--gen" />
<arg value="java" />
<arg value="-out" />
View
13 thrift/mapkeeper.thrift
@@ -60,6 +60,12 @@ struct StringListResponse
2:list<string> values,
}
+struct MetaData
+{
+ 1:ResponseCode responseCode,
+ 2:string implType,
+}
+
/**
* Note about map name:
* Thrift string type translates to std::string in C++ and String in
@@ -78,6 +84,13 @@ service MapKeeper
ResponseCode ping(),
/**
+ * Fetches mapkeeper metadata
+ *
+ * @return mapkeeper instance metadata
+ */
+ MetaData metadata(),
+
+ /**
* Add a new map.
*
* A map is a container for a collection of records.
Something went wrong with that request. Please try again.