Our server code includes a key value server, communicates with the loaf balancer through heartbeats and implements Raft.
Source code: src/server/*
class KeyValueOpsServiceImpl
: responds to client'sGet()
,Put()
requestsclass LBNodeCommClient
: communicates with the load balancer for hearbeats and leader asserts their leadershipclass RaftServer
: implementsRequestVote()
andAppendEntries()
Our client side implementation library resides here.
Source code : src/client/*
class KeyValueClient
: has the client implementation for makingGet()
andPut()
calls that is shared by the user and the load balancerclass KeyValueService
: has the implementation for the load balancer
Automates our test cases for Get()
and Put()
.
Source code: test/
read.cc
: TestsGet()
write.cc
: TestsPut()
run_read_script.sh
: Runs the tests forGet()
run_write_script.sh
: Runs the tests forPut()
Source code: src/util/*
- LevelDB Wrapper code:
levelDBWrapper.cc
- Locks code:
locks.cc
- Replicated Log Helper code :
replicated_log_persistent.cc
andreplicated_log_volatile.cc
- Voting state Helper code:
term_vote_persistent.cc
andterm_vote_volatile.cc
- Volatile state code:
state_volatile.cc
- State Helper code:
state_helper.cc
Note: For the persistent states of Raft, we also implemented volatile versions for fast lookups. The persistent state is stored in the storage/ folder.
|_src
|____third_party
|_______________leveldb
|_______________snappy
|_storage
Follow these steps to install gRPC lib using cmake [here] (https://grpc.io/docs/languages/cpp/quickstart/#setup)
:warning: make sure to limit the processes by passing number(e.g. 4) during make -j
command.
for example, instead of make -j
use make -j 4
Clone and follow the commands mentioned here and here
Clone and follow the commands mentioned here.
cd src/
chmod 755 build.sh
chmod 755 clean.sh
./clean.sh
./build.sh
cd test/
chmod 755 build.sh
chmod 755 clean.sh
./clean.sh
./build.sh
We need to start the loadbalancer and server
cd src/cmake/build
./loadbalancer <ip with port for client to connect> <ip with port for servers to send heartbeat>
./server <my kv ip with port> <my raft ip with port> <lb ip with port>
To run read (calls get API) test
cd test
chmod run_read_test.sh
chmod run_write_test.sh
./run_read_test
To run write (calls put API) test
cd test
chmod run_read_test.sh
chmod run_write_test.sh
./run_write_test
Results will be redirected to /results
Note: The run_read_test
and run_write_test
assume that the loadbalancer kv ip is 0.0.0.0:50051
.