Commit 5219d33b authored by Harshit Pande's avatar Harshit Pande

documentation

parent 905de3df
...@@ -22,22 +22,26 @@ var rft *raft.Raft ...@@ -22,22 +22,26 @@ var rft *raft.Raft
//Receiver fot RPC //Receiver fot RPC
type AppendEntries struct{} type AppendEntries struct{}
//encapsulate the return value of RPC //receiver for testing RPC
//only for testing purpose //only for testing purpose
type Tester struct{} type Tester struct{}
//RPC argument for testing the replication of keys value version across key value stores
type TestArgs struct { type TestArgs struct {
key string key string
value []byte value []byte
version uint64 version uint64
} }
// RPC argument with boolean value in the reply to confirm that indeed the replication went through across servers
type TestReply struct { type TestReply struct {
replica_updated bool replica_updated bool
} }
//only for testing purpose //only for testing purpose
//this function checks for the key value in its kvstore and sets replica_updated true if present and false if absent //this function checks for the key value in its kvstore and sets reply.replica_updated true if present and false if absent
//arguments: args contains the key, value, version to be matched
//reply is the reply to be sent
func (t *Tester) testerRPC(args *TestArgs, reply *TestReply) error { func (t *Tester) testerRPC(args *TestArgs, reply *TestReply) error {
table := raft.GetKeyValStr() table := raft.GetKeyValStr()
table.RLock() table.RLock()
......
...@@ -28,11 +28,11 @@ type Testpair struct { ...@@ -28,11 +28,11 @@ type Testpair struct {
// //
func TestAll(t *testing.T) { func TestAll(t *testing.T) {
//start the servers //start the servers
/*for i := 1; i <= NUM_SERVERS; i++ { for i := 1; i <= NUM_SERVERS; i++ {
go testServersCommunic(i, t) go testServersCommunic(i, t)
} }
//wait for some time so that servers are ready //wait for some time so that servers are ready
time.Sleep(4 * time.Second)*/ time.Sleep(4 * time.Second)
//run client that tries connecting to the followers //run client that tries connecting to the followers
testConnectFollower(t) testConnectFollower(t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment