Commit a212f611 authored by Sushant Mahajan's avatar Sushant Mahajan

rearranged structs and functions

parent bde95ec0
...@@ -2,12 +2,9 @@ package main ...@@ -2,12 +2,9 @@ package main
import ( import (
"fmt" "fmt"
<<<<<<< HEAD
=======
"log" "log"
"net" "net"
"net/rpc" "net/rpc"
>>>>>>> 67cd155b37c8122a61dfc1cfdaead50ea7f5729a
"os" "os"
"reflect" "reflect"
"strconv" "strconv"
...@@ -57,6 +54,12 @@ type Raft struct { ...@@ -57,6 +54,12 @@ type Raft struct {
id int //this server id id int //this server id
} }
type Args struct {
X int
}
type AppendEntries struct{}
var cluster_config *ClusterConfig var cluster_config *ClusterConfig
func NewRaft(config *ClusterConfig, thisServerId int, commitCh chan LogEntry) (*Raft, error) { func NewRaft(config *ClusterConfig, thisServerId int, commitCh chan LogEntry) (*Raft, error) {
...@@ -108,14 +111,6 @@ func (raft *Raft) Append(data []byte) (LogEntry, error) { ...@@ -108,14 +111,6 @@ func (raft *Raft) Append(data []byte) (LogEntry, error) {
return temp, nil return temp, nil
} }
type RPChandle struct {
}
func (r *RPChandle) AppendEntriesRPC(log_entry LogEntryData) bool {
return true
}
func NewServerConfig(server_id int) (*ServerConfig, error) { func NewServerConfig(server_id int) (*ServerConfig, error) {
server := new(ServerConfig) server := new(ServerConfig)
server.Id = server_id server.Id = server_id
...@@ -146,12 +141,6 @@ func start_rpc(this_server *ServerConfig) { ...@@ -146,12 +141,6 @@ func start_rpc(this_server *ServerConfig) {
//rpc.Register() //rpc.Register()
} }
type Args struct {
X int
}
type AppendEntries struct{}
func (t *AppendEntries) AppendEntriesRPC(args *Args, reply *int) error { func (t *AppendEntries) AppendEntriesRPC(args *Args, reply *int) error {
*reply = args.X *reply = args.X
return nil return nil
......
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