From 3a33456ba211b365a85bfcfc76572ed015b2e0fc Mon Sep 17 00:00:00 2001 From: Irene Zhang <iyzhang@myst.cs.washington.edu> Date: Thu, 25 Jun 2015 17:35:31 -0700 Subject: [PATCH] cleaning up transactional store code for gitlab --- replication/common/replica.h | 2 +- store/txnstore/Rules.mk | 20 +++++---- store/txnstore/lib/lockstore.cc | 33 ++++++++++++--- store/txnstore/lib/lockstore.h | 48 ++++++++++++++++------ store/txnstore/lib/occstore.cc | 33 ++++++++++++--- store/txnstore/lib/occstore.h | 39 ++++++++++++++---- store/txnstore/lib/txnstore.cc | 32 +++++++++++++-- store/txnstore/lib/txnstore.h | 39 ++++++++++++++---- store/txnstore/server.cc | 73 ++++++++++++++++++++++----------- store/txnstore/server.h | 55 +++++++++++++++++-------- store/txnstore/shardclient.cc | 31 ++++++++++++-- store/txnstore/shardclient.h | 33 +++++++-------- store/txnstore/txn-proto.proto | 2 +- 13 files changed, 327 insertions(+), 113 deletions(-) diff --git a/replication/common/replica.h b/replication/common/replica.h index 6d78e62..966efcd 100644 --- a/replication/common/replica.h +++ b/replication/common/replica.h @@ -5,7 +5,7 @@ * interface to different vr protocols * * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> - * Naveen Kr. Sharma <nksharma@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> * Dan R. K. Ports <drkp@cs.washington.edu> * * Permission is hereby granted, free of charge, to any person diff --git a/store/txnstore/Rules.mk b/store/txnstore/Rules.mk index c8ccff2..55825b6 100644 --- a/store/txnstore/Rules.mk +++ b/store/txnstore/Rules.mk @@ -1,18 +1,22 @@ d := $(dir $(lastword $(MAKEFILE_LIST))) SRCS += $(addprefix $(d), \ - client.cc spanclient.cc lockserver.cc \ - occstore.cc lockstore.cc server.cc) + client.cc shardclient.cc server.cc) PROTOS += $(addprefix $(d), txn-proto.proto) -OBJS-span-store := $(LIB-message) $(LIB-store) $(LIB-common) $(o)server.o \ - $(o)occstore.o $(o)lockstore.o $(o)lockserver.o $(o)span-proto.o +OBJS-txn-store := $(LIB-message) $(LIB-common) \ +$(LIB-backend) $(o)server.o \ +$(o)txn-proto.o -OBJS-span-client := $(LIB-udptransport) $(LIB-request) $(LIB-common) \ - $(LIB-latency) $(OBJS-vr-client) $(o)span-proto.o $(o)spanclient.o $(o)client.o +OBJS-txn-client := $(o)txn-proto.o $(o)shardclient.o $(o)client.o -$(d)server: $(LIB-udptransport) $(OBJS-span-store) \ - $(OBJS-vr-replica) $(OBJS-span-store) +include $(d)lib/Rules.mk + +$(d)client: $(LIB-udptransport) $(LIB-request) $(LIB-common) \ + $(LIB-latency) $(OBJS-vr-client) $(OBJS-txn-client) + +$(d)server: $(LIB-udptransport) $(LIB-txnstore) \ + $(OBJS-vr-replica) $(OBJS-txn-store) BINS += $(d)server diff --git a/store/txnstore/lib/lockstore.cc b/store/txnstore/lib/lockstore.cc index cb5782e..5518e2f 100644 --- a/store/txnstore/lib/lockstore.cc +++ b/store/txnstore/lib/lockstore.cc @@ -1,17 +1,40 @@ // -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*- -// vim: set ts=4 sw=4: /*********************************************************************** * - * nistore/lockstore.cc: + * store/txnstore/lib/lockstore.h: * Key-value store with support for S2PL * + * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * Dan R. K. Ports <drkp@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * **********************************************************************/ -#include "spanstore/lockstore.h" +#include "lockstore.h" using namespace std; -namespace spanstore { +namespace txnstore { LockStore::LockStore() : TxnStore(), store() { } LockStore::~LockStore() { } @@ -132,4 +155,4 @@ LockStore::getLocks(uint64_t id, const Transaction &txn) return ret; } -} // namespace spanstore +} // namespace txnstore diff --git a/store/txnstore/lib/lockstore.h b/store/txnstore/lib/lockstore.h index 6c68e73..a8f2d9c 100644 --- a/store/txnstore/lib/lockstore.h +++ b/store/txnstore/lib/lockstore.h @@ -1,30 +1,52 @@ // -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*- -// vim: set ts=4 sw=4: /*********************************************************************** * - * common/lockstore.h - - * Single-node Key-value store with support for 2PC locking-based - * transactions using S2PL + * store/txnstore/lib/lockstore.h: + * Single-node Key-value store with support for 2PC locking-based + * transactions using S2PL + * + * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * Dan R. K. Ports <drkp@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * **********************************************************************/ #ifndef _LOCK_STORE_H_ #define _LOCK_STORE_H_ -#include "paxos-lib/lib/assert.h" -#include "paxos-lib/lib/message.h" -#include "common/kvstore.h" -#include "common/txnstore.h" -#include "common/transaction.h" -#include "spanstore/lockserver.h" +#include "lib/assert.h" +#include "lib/message.h" +#include "store/common/backend/kvstore.h" +#include "txnstore.h" +#include "store/common/transaction.h" +#include "store/common/backend/lockserver.h" #include <vector> #include <unordered_map> #include <set> #include <map> #include <list> -namespace spanstore { +namespace txnstore { class LockStore : public TxnStore { @@ -56,6 +78,6 @@ private: bool getLocks(uint64_t id, const Transaction &txn); }; -} // namespace spanstore +} // namespace txnstore #endif /* _LOCK_STORE_H_ */ diff --git a/store/txnstore/lib/occstore.cc b/store/txnstore/lib/occstore.cc index 5317562..ea3327e 100644 --- a/store/txnstore/lib/occstore.cc +++ b/store/txnstore/lib/occstore.cc @@ -1,17 +1,40 @@ // -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*- -// vim: set ts=4 sw=4: /*********************************************************************** * - * spanstore/occstore.cc: + * store/txnstore/lib/occstore.cc: * Key-value store with support for OCC * + * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * Dan R. K. Ports <drkp@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * **********************************************************************/ -#include "spanstore/occstore.h" +#include "occstore.h" using namespace std; -namespace spanstore { +namespace txnstore { OCCStore::OCCStore() : store() { } OCCStore::~OCCStore() { } @@ -161,4 +184,4 @@ OCCStore::getPreparedReadWrites() return readwrites; } -} // namespace spanstore +} // namespace txnstore diff --git a/store/txnstore/lib/occstore.h b/store/txnstore/lib/occstore.h index b7c0057..693881f 100644 --- a/store/txnstore/lib/occstore.h +++ b/store/txnstore/lib/occstore.h @@ -1,20 +1,43 @@ // -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*- -// vim: set ts=4 sw=4: /*********************************************************************** * - * spanstore/occstore.h: + * store/txnstore/lib/occstore.h: * Key-value store with support for transactions using OCC. * + * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * Dan R. K. Ports <drkp@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * **********************************************************************/ #ifndef _OCC_STORE_H_ #define _OCC_STORE_H_ -#include "paxos-lib/lib/assert.h" -#include "paxos-lib/lib/message.h" -#include "common/versionedKVStore.h" -#include "common/txnstore.h" -#include "common/transaction.h" +#include "lib/assert.h" +#include "lib/message.h" +#include "store/common/backend/versionstore.h" +#include "txnstore.h" +#include "store/common/transaction.h" #include <vector> #include <unordered_map> @@ -22,7 +45,7 @@ #include <map> #include <list> -namespace spanstore { +namespace txnstore { class OCCStore : public TxnStore { diff --git a/store/txnstore/lib/txnstore.cc b/store/txnstore/lib/txnstore.cc index 54b0a66..0eec49a 100644 --- a/store/txnstore/lib/txnstore.cc +++ b/store/txnstore/lib/txnstore.cc @@ -1,14 +1,39 @@ // -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*- -// vim: set ts=4 sw=4: /*********************************************************************** * - * common/txnstore.cc: + * store/txnstore/lib/txnstore.h: * Interface for a single node transactional store serving as a * server-side backend * + * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * Dan R. K. Ports <drkp@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * **********************************************************************/ -#include "common/txnstore.h" +#include "txnstore.h" + +namespace txnstore { using namespace std; @@ -69,3 +94,4 @@ TxnStore::Load(const string &key, const string &value, const Timestamp ×tam { Panic("Unimplemented LOAD"); } +} // namespace txnstore diff --git a/store/txnstore/lib/txnstore.h b/store/txnstore/lib/txnstore.h index d46a9e0..6791c57 100644 --- a/store/txnstore/lib/txnstore.h +++ b/store/txnstore/lib/txnstore.h @@ -1,20 +1,43 @@ // -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*- -// vim: set ts=4 sw=4: /*********************************************************************** * - * common/txnstore.h: + * store/txnstore/lib/txnstore.h: * Interface for a single node transactional store serving as a * server-side backend * + * Copyright 2013-2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * Dan R. K. Ports <drkp@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * **********************************************************************/ #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" +#include "lib/assert.h" +#include "lib/message.h" +#include "store/common/transaction.h" +#include "store/common/timestamp.h" // Reply types #define REPLY_OK 0 @@ -25,6 +48,8 @@ #define REPLY_NETWORK_FAILURE 5 #define REPLY_MAX 6 +namespace txnstore { + class TxnStore { public: @@ -59,5 +84,5 @@ public: virtual void Load(const std::string &key, const std::string &value, const Timestamp ×tamp); }; - +} // namespace txnstore #endif /* _TXN_STORE_H_ */ diff --git a/store/txnstore/server.cc b/store/txnstore/server.cc index 87f26b3..d51a050 100644 --- a/store/txnstore/server.cc +++ b/store/txnstore/server.cc @@ -2,16 +2,39 @@ // vim: set ts=4 sw=4: /*********************************************************************** * - * spanstore/server.cc: - * Implementation of a single SpanStore server. + * store/txnstore/server.cc: + * Implementation of a single transactional key-value server. + * + * Copyright 2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <nksharma@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * **********************************************************************/ -#include "spanstore/server.h" +#include "server.h" using namespace std; -namespace spanstore { +namespace txnstore { using namespace proto; @@ -22,11 +45,11 @@ Server::Server(Mode mode, uint64_t skew, uint64_t error) : mode(mode) switch (mode) { case MODE_LOCK: case MODE_SPAN_LOCK: - store = new spanstore::LockStore(); + store = new txnstore::LockStore(); break; case MODE_OCC: case MODE_SPAN_OCC: - store = new spanstore::OCCStore(); + store = new txnstore::OCCStore(); break; default: NOT_REACHABLE(); @@ -50,7 +73,7 @@ Server::LeaderUpcall(opnum_t opnum, const string &str1, bool &replicate, string request.ParseFromString(str1); switch (request.op()) { - case spanstore::proto::Request::GET: + case txnstore::proto::Request::GET: if (request.get().has_timestamp()) { pair<Timestamp, string> val; status = store->Get(request.txnid(), request.get().key(), @@ -70,7 +93,7 @@ Server::LeaderUpcall(opnum_t opnum, const string &str1, bool &replicate, string reply.set_status(status); reply.SerializeToString(&str2); break; - case spanstore::proto::Request::PREPARE: + case txnstore::proto::Request::PREPARE: // Prepare is the only case that is conditionally run at the leader status = store->Prepare(request.txnid(), Transaction(request.prepare().txn())); @@ -90,11 +113,11 @@ Server::LeaderUpcall(opnum_t opnum, const string &str1, bool &replicate, string reply.SerializeToString(&str2); } break; - case spanstore::proto::Request::COMMIT: + case txnstore::proto::Request::COMMIT: replicate = true; str2 = str1; break; - case spanstore::proto::Request::ABORT: + case txnstore::proto::Request::ABORT: replicate = true; str2 = str1; break; @@ -122,9 +145,9 @@ Server::ReplicaUpcall(opnum_t opnum, request.ParseFromString(str1); switch (request.op()) { - case spanstore::proto::Request::GET: + case txnstore::proto::Request::GET: return; - case spanstore::proto::Request::PREPARE: + case txnstore::proto::Request::PREPARE: // get a prepare timestamp and return to client store->Prepare(request.txnid(), Transaction(request.prepare().txn())); @@ -132,10 +155,10 @@ Server::ReplicaUpcall(opnum_t opnum, reply.set_timestamp(request.prepare().timestamp()); } break; - case spanstore::proto::Request::COMMIT: + case txnstore::proto::Request::COMMIT: store->Commit(request.txnid(), request.commit().timestamp()); break; - case spanstore::proto::Request::ABORT: + case txnstore::proto::Request::ABORT: store->Abort(request.txnid(), Transaction(request.abort().txn())); break; default: @@ -154,7 +177,7 @@ Server::UnloggedUpcall(const string &str1, string &str2) request.ParseFromString(str1); - ASSERT(request.op() == spanstore::proto::Request::GET); + ASSERT(request.op() == txnstore::proto::Request::GET); if (request.get().has_timestamp()) { pair<Timestamp, string> val; @@ -182,7 +205,7 @@ Server::Load(const string &key, const string &value, const Timestamp timestamp) store->Load(key, value, timestamp); } -} // namespace spanstore +} // namespace txnstore int main(int argc, char **argv) @@ -192,7 +215,7 @@ main(int argc, char **argv) const char *configPath = NULL; const char *keyPath = NULL; uint64_t skew = 0, error = 0; - spanstore::Mode mode; + txnstore::Mode mode; // Parse arguments int opt; @@ -216,13 +239,13 @@ main(int argc, char **argv) case 'm': { if (strcasecmp(optarg, "lock") == 0) { - mode = spanstore::MODE_LOCK; + mode = txnstore::MODE_LOCK; } else if (strcasecmp(optarg, "occ") == 0) { - mode = spanstore::MODE_OCC; + mode = txnstore::MODE_OCC; } else if (strcasecmp(optarg, "span-lock") == 0) { - mode = spanstore::MODE_SPAN_LOCK; + mode = txnstore::MODE_SPAN_LOCK; } else if (strcasecmp(optarg, "span-occ") == 0) { - mode = spanstore::MODE_SPAN_OCC; + mode = txnstore::MODE_SPAN_OCC; } else { fprintf(stderr, "unknown mode '%s'\n", optarg); } @@ -305,7 +328,7 @@ main(int argc, char **argv) fprintf(stderr, "option -i is required\n"); } - if (mode == spanstore::MODE_UNKNOWN) { + if (mode == txnstore::MODE_UNKNOWN) { fprintf(stderr, "option -m is required\n"); } @@ -314,7 +337,7 @@ main(int argc, char **argv) if (configStream.fail()) { fprintf(stderr, "unable to read configuration file: %s\n", configPath); } - specpaxos::Configuration config(configStream); + transport::Configuration config(configStream); if (index >= config.n) { fprintf(stderr, "replica index %d is out of bounds; " @@ -323,8 +346,8 @@ main(int argc, char **argv) UDPTransport transport(0.0, 0.0, 0); - spanstore::Server server(mode, skew, error); - specpaxos::vr::VRReplica replica(config, index, &transport, 1, &server); + txnstore::Server server(mode, skew, error); + replication::vr::VRReplica replica(config, index, &transport, 1, &server); if (keyPath) { string key; diff --git a/store/txnstore/server.h b/store/txnstore/server.h index b72fa9f..a691f60 100644 --- a/store/txnstore/server.h +++ b/store/txnstore/server.h @@ -2,25 +2,46 @@ // vim: set ts=4 sw=4: /*********************************************************************** * - * spanstore/replica.h: - * A single SpanStore server replica. + * store/txnstore/server.h: + * A single transactional server replica. + * + * Copyright 2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <nksharma@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * **********************************************************************/ -#ifndef _SPAN_SERVER_H_ -#define _SPAN_SERVER_H_ +#ifndef _TXN_SERVER_H_ +#define _TXN_SERVER_H_ -#include "paxos-lib/lib/configuration.h" -#include "paxos-lib/common/replica.h" -#include "paxos-lib/lib/udptransport.h" -#include "paxos-lib/vr/replica.h" -#include "common/truetime.h" -#include "common/txnstore.h" -#include "spanstore/occstore.h" -#include "spanstore/lockstore.h" -#include "spanstore/span-proto.pb.h" +//#include "lib/configuration.h" +#include "lib/udptransport.h" +#include "replication/vr/replica.h" +#include "store/common/truetime.h" +#include "store/txnstore/lib/occstore.h" +#include "store/txnstore/lib/lockstore.h" +#include "store/txnstore/txn-proto.pb.h" -namespace spanstore { +namespace txnstore { enum Mode { MODE_UNKNOWN, @@ -30,7 +51,7 @@ enum Mode { MODE_SPAN_LOCK }; -class Server : public specpaxos::AppReplica +class Server : public replication::AppReplica { public: Server(Mode mode, uint64_t skew, uint64_t error); @@ -47,6 +68,6 @@ private: TrueTime timeServer; }; -} // namespace spanstore +} // namespace txnstore -#endif /* _SPAN_SERVER_H_ */ +#endif /* _TXN_SERVER_H_ */ diff --git a/store/txnstore/shardclient.cc b/store/txnstore/shardclient.cc index 65f321f..32e1ce8 100644 --- a/store/txnstore/shardclient.cc +++ b/store/txnstore/shardclient.cc @@ -2,13 +2,36 @@ // vim: set ts=4 sw=4: /*********************************************************************** * - * spanstore/spanclient.cc: - * Single shard SpanStore client implementation. + * store/txnstore/shardclient.h: + * Single shard transactional client interface. + * + * Copyright 2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * **********************************************************************/ -#include "spanstore/spanclient.h" -#include "common/txnstore.h" +#include "txnclient.h" +#include "store/common/transaction.h" namespace spanstore { diff --git a/store/txnstore/shardclient.h b/store/txnstore/shardclient.h index 6bbdb24..711009e 100644 --- a/store/txnstore/shardclient.h +++ b/store/txnstore/shardclient.h @@ -2,10 +2,11 @@ // vim: set ts=4 sw=4: /*********************************************************************** * - * store/qwstore/shardclient.h: - * Single shard QWStore client interface. + * store/txnstore/shardclient.h: + * Single shard transactional client interface. * * Copyright 2015 Irene Zhang <iyzhang@cs.washington.edu> + * Naveen Kr. Sharma <naveenks@cs.washington.edu> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -29,24 +30,24 @@ * **********************************************************************/ -#ifndef _SPAN_TXN_CLIENT_H_ -#define _SPAN_TXN_CLIENT_H_ +#ifndef _TXN_CLIENT_H_ +#define _TXN_CLIENT_H_ -#include "paxos-lib/lib/assert.h" -#include "paxos-lib/lib/message.h" -#include "paxos-lib/lib/transport.h" -#include "paxos-lib/common/client.h" -#include "paxos-lib/vr/client.h" -#include "common/txnclient.h" -#include "common/timestamp.h" -#include "common/transaction.h" -#include "spanstore/span-proto.pb.h" +#include "lib/assert.h" +#include "lib/message.h" +#include "lib/transport.h" +#include "store/common/client.h" +#include "replication/vr/client.h" +#include "txnclient.h" +#include "store/common/timestamp.h" +#include "store/common/transaction.h" +#include "store/txnstore/txn-proto.pb.h" #include <string> #include <mutex> #include <condition_variable> -namespace spanstore { +namespace txnstore { enum Mode { MODE_UNKNOWN, @@ -117,6 +118,6 @@ private: }; -} // namespace spanstore +} // namespace txnstore -#endif /* _SPAN_TXN_CLIENT_H_ */ +#endif /* _TXN_CLIENT_H_ */ diff --git a/store/txnstore/txn-proto.proto b/store/txnstore/txn-proto.proto index 9df73b1..6defa83 100644 --- a/store/txnstore/txn-proto.proto +++ b/store/txnstore/txn-proto.proto @@ -1,6 +1,6 @@ import "store/common/common-proto.proto"; -package spanstore.proto; +package txnstore.proto; message GetMessage { required string key = 1; -- GitLab