Skip to content
Snippets Groups Projects
Commit 6477a9fe authored by Naveen Kr. Sharma's avatar Naveen Kr. Sharma
Browse files

Moving common store files out of txnstore and fixing Rules.mk

parent 0297e36f
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 189 deletions
...@@ -2,7 +2,8 @@ d := $(dir $(lastword $(MAKEFILE_LIST))) ...@@ -2,7 +2,8 @@ d := $(dir $(lastword $(MAKEFILE_LIST)))
SRCS += $(addprefix $(d), \ SRCS += $(addprefix $(d), \
lookup3.cc message.cc memory.cc \ lookup3.cc message.cc memory.cc \
latency.cc configuration.cc transport.cc udptransport.cc simtransport.cc) latency.cc configuration.cc transport.cc \
udptransport.cc simtransport.cc)
PROTOS += $(addprefix $(d), \ PROTOS += $(addprefix $(d), \
latency-format.proto) latency-format.proto)
...@@ -25,5 +26,4 @@ LIB-simtransport := $(o)simtransport.o $(LIB-transport) ...@@ -25,5 +26,4 @@ LIB-simtransport := $(o)simtransport.o $(LIB-transport)
LIB-udptransport := $(o)udptransport.o $(LIB-transport) LIB-udptransport := $(o)udptransport.o $(LIB-transport)
include $(d)tests/Rules.mk include $(d)tests/Rules.mk
...@@ -6,6 +6,7 @@ PROTOS += $(addprefix $(d), locks-proto.proto) ...@@ -6,6 +6,7 @@ PROTOS += $(addprefix $(d), locks-proto.proto)
$(d)server: $(LIB-udptransport) $(OBJS-ir-replica) $(o)locks-proto.o $(o)server.o $(d)server: $(LIB-udptransport) $(OBJS-ir-replica) $(o)locks-proto.o $(o)server.o
$(d)client: $(LIB-udptransport) $(OBJS-ir-client) $(LIB-common) $(o)locks-proto.o $(o)client.o $(d)client: $(LIB-udptransport) $(OBJS-ir-client) $(LIB-store-common) \
$(o)locks-proto.o $(o)client.o
BINS += $(d)server $(d)client BINS += $(d)server $(d)client
...@@ -9,8 +9,8 @@ PROTOS += $(addprefix $(d), \ ...@@ -9,8 +9,8 @@ PROTOS += $(addprefix $(d), \
LIB-request := $(o)request.o LIB-request := $(o)request.o
OBJS-client := $(o)client.o \ OBJS-client := $(o)client.o \
$(LIB-message) $(LIB-configuration) $(LIB-transport) \ $(LIB-message) $(LIB-configuration) \
$(LIB-request) $(LIB-transport) $(LIB-request)
OBJS-replica := $(o)replica.o $(o)log.o \ OBJS-replica := $(o)replica.o $(o)log.o \
$(LIB-message) $(LIB-request) \ $(LIB-message) $(LIB-request) \
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* *
* Copyright 2013-2015 Dan R. K. Ports <drkp@cs.washington.edu> * Copyright 2013-2015 Dan R. K. Ports <drkp@cs.washington.edu>
* Irene Zhang Ports <iyzhang@cs.washington.edu> * Irene Zhang Ports <iyzhang@cs.washington.edu>
*
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without * files (the "Software"), to deal in the Software without
......
d := $(dir $(lastword $(MAKEFILE_LIST))) d := $(dir $(lastword $(MAKEFILE_LIST)))
SRCS += $(addprefix $(d), \ SRCS += $(addprefix $(d), promise.cc timestamp.cc tracer.cc \
timestamp.cc transaction.cc promise.cc tracer.cc truetime.cc) transaction.cc truetime.cc)
PROTOS += $(addprefix $(d), common-proto.proto) PROTOS += $(addprefix $(d), common-proto.proto)
LIB-common := $(o)timestamp.o $(o)transaction.o $(o)promise.o $(o)truetime.o $(o)common-proto.o $(o)tracer.o LIB-store-common := $(o)common-proto.o $(o)promise.o $(o)timestamp.o \
$(o)tracer.o $(o)transaction.o $(o)truetime.o
include store/common/frontend/Rules.mk include $(d)backend/Rules.mk $(d)frontend/Rules.mk
include store/common/backend/Rules.mk
d := $(dir $(lastword $(MAKEFILE_LIST))) d := $(dir $(lastword $(MAKEFILE_LIST)))
SRCS += $(addprefix $(d), \ SRCS += $(addprefix $(d), \
kvstore.cc lockserver.cc versionstore.cc) kvstore.cc lockserver.cc txnstore.cc versionstore.cc)
LIB-backend := $(o)kvstore.o $(o)versionstore.o $(o)lockserver.o LIB-store-backend := $(o)kvstore.o $(o)lockserver.o $(o)txnstore.o $(o)versionstore.o
include $(d)tests/Rules.mk include $(d)tests/Rules.mk
\ No newline at end of file
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
* *
**********************************************************************/ **********************************************************************/
#include "txnstore.h" #include "store/common/backend/txnstore.h"
namespace txnstore {
using namespace std; using namespace std;
...@@ -94,4 +92,3 @@ TxnStore::Load(const string &key, const string &value, const Timestamp &timestam ...@@ -94,4 +92,3 @@ TxnStore::Load(const string &key, const string &value, const Timestamp &timestam
{ {
Panic("Unimplemented LOAD"); Panic("Unimplemented LOAD");
} }
} // namespace txnstore
...@@ -48,8 +48,6 @@ ...@@ -48,8 +48,6 @@
#define REPLY_NETWORK_FAILURE 5 #define REPLY_NETWORK_FAILURE 5
#define REPLY_MAX 6 #define REPLY_MAX 6
namespace txnstore {
class TxnStore class TxnStore
{ {
public: public:
...@@ -84,5 +82,5 @@ public: ...@@ -84,5 +82,5 @@ public:
virtual void Load(const std::string &key, const std::string &value, virtual void Load(const std::string &key, const std::string &value,
const Timestamp &timestamp); const Timestamp &timestamp);
}; };
} // namespace txnstore
#endif /* _TXN_STORE_H_ */ #endif /* _TXN_STORE_H_ */
message TimestampMessage { message TimestampMessage {
required uint64 timestamp = 1; required uint64 id = 1;
required uint64 id = 2; required uint64 timestamp = 2;
} }
message ReadMessage { message ReadMessage {
......
d := $(dir $(lastword $(MAKEFILE_LIST))) d := $(dir $(lastword $(MAKEFILE_LIST)))
SRCS += $(addprefix $(d), \ SRCS += $(addprefix $(d), bufferclient.cc shardclient.cc client.cc)
bufferclient.cc client.cc shardclient.cc)
LIB-frontend := $(o)bufferclient.o $(o)txnclient.o $(o)client.o LIB-store-frontend := $(o)bufferclient.o $(o)shardclient.o $(o)client.o
...@@ -4,11 +4,13 @@ SRCS += $(addprefix $(d), client.cc shardclient.cc qwstore.cc server.cc) ...@@ -4,11 +4,13 @@ SRCS += $(addprefix $(d), client.cc shardclient.cc qwstore.cc server.cc)
PROTOS += $(addprefix $(d), qw-proto.proto) PROTOS += $(addprefix $(d), qw-proto.proto)
OBJS-qw-server := $(LIB-backend) $(o)qw-proto.o $(o)qwstore.o $(o)server.o OBJS-qw-server := $(LIB-message) $(LIB-udptransport) $(LIB-request) \
$(LIB-store-common) $(LIB-store-backend) \
$(o)qw-proto.o $(o)qwstore.o $(o)server.o
OBJS-qw-client := $(LIB-message) $(LIB-udptransport) $(LIB-request) $(LIB-common) \ OBJS-qw-client := $(LIB-message) $(LIB-udptransport) $(LIB-request) $(LIB-store-frontend) \
$(LIB-frontend) $(o)qw-proto.o $(o)shardclient.o $(o)client.o $(o)qw-proto.o $(o)shardclient.o $(o)client.o
$(d)server: $(LIB-message) $(LIB-udptransport) $(LIB-request) $(LIB-common) $(OBJS-qw-server) $(d)server: $(OBJS-qw-server)
BINS += $(d)server BINS += $(d)server
d := $(dir $(lastword $(MAKEFILE_LIST))) d := $(dir $(lastword $(MAKEFILE_LIST)))
SRCS += $(addprefix $(d), \ SRCS += $(addprefix $(d), occstore.cc lockstore.cc server.cc \
client.cc shardclient.cc server.cc) client.cc shardclient.cc)
PROTOS += $(addprefix $(d), txn-proto.proto) PROTOS += $(addprefix $(d), txn-proto.proto)
OBJS-txn-store := $(LIB-message) $(LIB-common) \ LIB-txnstore := $(o)occstore.o $(o)lockstore.o
$(LIB-backend) $(o)server.o \
$(o)txn-proto.o
OBJS-txn-client := $(o)txn-proto.o $(o)shardclient.o $(o)client.o OBJS-txn-store := $(LIB-message) $(LIB-txnstore) $(LIB-store-common) \
$(LIB-store-backend) $(o)txn-proto.o $(o)server.o
include $(d)lib/Rules.mk
$(d)client: $(LIB-udptransport) $(LIB-request) $(LIB-common) \ OBJS-txn-client := $(o)txn-proto.o $(o)shardclient.o $(o)client.o
$(LIB-latency) $(OBJS-vr-client) $(OBJS-txn-client)
$(d)server: $(LIB-udptransport) $(LIB-txnstore) \ $(d)server: $(LIB-udptransport) $(OBJS-vr-replica) $(OBJS-txn-store)
$(OBJS-vr-replica) $(OBJS-txn-store)
BINS += $(d)server BINS += $(d)server
d := $(dir $(lastword $(MAKEFILE_LIST)))
SRCS += $(addprefix $(d), \
txnstore.cc occstore.cc lockstore.cc)
LIB-txnstore := $(o)txnstore.o $(o)occstore.o $(o)lockstore.o
\ No newline at end of file
// -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*-
// vim: set ts=4 sw=4:
/***********************************************************************
*
* common/txnstore.cc:
* Interface for a single node transactional store serving as a
* server-side backend
*
**********************************************************************/
#include "common/txnstore.h"
using namespace std;
TxnStore::TxnStore() {}
TxnStore::~TxnStore() {}
int
TxnStore::Get(uint64_t id, const string &key, pair<Timestamp, string> &value)
{
Panic("Unimplemented GET");
return 0;
}
int
TxnStore::Get(uint64_t id, const string &key, const Timestamp &timestamp,
pair<Timestamp, string> &value)
{
Panic("Unimplemented GET");
return 0;
}
int
TxnStore::Put(uint64_t id, const string &key, const string &value)
{
Panic("Unimplemented PUT");
return 0;
}
int
TxnStore::Prepare(uint64_t id, const Transaction &txn)
{
Panic("Unimplemented PREPARE");
return 0;
}
int
TxnStore::Prepare(uint64_t id, const Transaction &txn,
const Timestamp &timestamp, Timestamp &proposed)
{
Panic("Unimplemented PREPARE");
return 0;
}
void
TxnStore::Commit(uint64_t id, uint64_t timestamp)
{
Panic("Unimplemented COMMIT");
}
void
TxnStore::Abort(uint64_t id, const Transaction &txn)
{
Panic("Unimplemented ABORT");
}
void
TxnStore::Load(const string &key, const string &value, const Timestamp &timestamp)
{
Panic("Unimplemented LOAD");
}
// -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*-
// vim: set ts=4 sw=4:
/***********************************************************************
*
* common/txnstore.h:
* Interface for a single node transactional store serving as a
* server-side backend
*
**********************************************************************/
#ifndef _TXN_STORE_H_
#define _TXN_STORE_H_
#include "paxos-lib/lib/assert.h"
#include "paxos-lib/lib/message.h"
#include "common/transaction.h"
#include "common/timestamp.h"
// Reply types
#define REPLY_OK 0
#define REPLY_FAIL 1
#define REPLY_RETRY 2
#define REPLY_ABSTAIN 3
#define REPLY_TIMEOUT 4
#define REPLY_NETWORK_FAILURE 5
#define REPLY_MAX 6
class TxnStore
{
public:
TxnStore();
virtual ~TxnStore();
// add key to read set
virtual int Get(uint64_t id, const std::string &key,
std::pair<Timestamp, std::string> &value);
virtual int Get(uint64_t id, const std::string &key,
const Timestamp &timestamp, std::pair<Timestamp, std::string> &value);
// add key to write set
virtual int Put(uint64_t id, const std::string &key,
const std::string &value);
// check whether we can commit this transaction (and lock the read/write set)
virtual int Prepare(uint64_t id, const Transaction &txn);
virtual int Prepare(uint64_t id, const Transaction &txn,
const Timestamp &timestamp, Timestamp &proposed);
// commit the transaction
virtual void Commit(uint64_t id, uint64_t timestamp = 0);
// abort a running transaction
virtual void Abort(uint64_t id, const Transaction &txn = Transaction());
// load keys
virtual void Load(const std::string &key, const std::string &value,
const Timestamp &timestamp);
};
#endif /* _TXN_STORE_H_ */
File moved
...@@ -36,15 +36,16 @@ ...@@ -36,15 +36,16 @@
#include "lib/assert.h" #include "lib/assert.h"
#include "lib/message.h" #include "lib/message.h"
#include "store/common/backend/kvstore.h"
#include "txnstore.h"
#include "store/common/transaction.h" #include "store/common/transaction.h"
#include "store/common/backend/kvstore.h"
#include "store/common/backend/txnstore.h"
#include "store/common/backend/lockserver.h" #include "store/common/backend/lockserver.h"
#include <vector>
#include <unordered_map>
#include <set> #include <set>
#include <map> #include <map>
#include <list> #include <list>
#include <vector>
#include <unordered_map>
namespace txnstore { namespace txnstore {
......
File moved
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "lib/assert.h" #include "lib/assert.h"
#include "lib/message.h" #include "lib/message.h"
#include "store/common/backend/versionstore.h" #include "store/common/backend/versionstore.h"
#include "txnstore.h" #include "store/common/backend/txnstore.h"
#include "store/common/transaction.h" #include "store/common/transaction.h"
#include <vector> #include <vector>
......
...@@ -211,7 +211,7 @@ int ...@@ -211,7 +211,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int index = -1; int index = -1;
int myShard=0, maxShard=1, nKeys=1; unsigned int myShard=0, maxShard=1, nKeys=1;
const char *configPath = NULL; const char *configPath = NULL;
const char *keyPath = NULL; const char *keyPath = NULL;
int64_t skew = 0, error = 0; int64_t skew = 0, error = 0;
...@@ -278,7 +278,7 @@ main(int argc, char **argv) ...@@ -278,7 +278,7 @@ main(int argc, char **argv)
{ {
char *strtolPtr; char *strtolPtr;
nKeys = strtoul(optarg, &strtolPtr, 10); nKeys = strtoul(optarg, &strtolPtr, 10);
if ((*optarg == '\0') || (*strtolPtr != '\0') || (nKeys < 0)) if ((*optarg == '\0') || (*strtolPtr != '\0'))
{ {
fprintf(stderr, "option -e requires a numeric arg\n"); fprintf(stderr, "option -e requires a numeric arg\n");
} }
...@@ -289,7 +289,7 @@ main(int argc, char **argv) ...@@ -289,7 +289,7 @@ main(int argc, char **argv)
{ {
char *strtolPtr; char *strtolPtr;
myShard = strtoul(optarg, &strtolPtr, 10); myShard = strtoul(optarg, &strtolPtr, 10);
if ((*optarg == '\0') || (*strtolPtr != '\0') || (myShard < 0)) if ((*optarg == '\0') || (*strtolPtr != '\0'))
{ {
fprintf(stderr, "option -e requires a numeric arg\n"); fprintf(stderr, "option -e requires a numeric arg\n");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment