Commit a8826caf authored by Harshit Pande's avatar Harshit Pande

commit channel monitor

parents 73daaa01 e0a060fd
...@@ -50,6 +50,9 @@ type SharedLog interface { ...@@ -50,6 +50,9 @@ type SharedLog interface {
type Raft struct { type Raft struct {
//some good stuff needs to go here //some good stuff needs to go here
commitCh chan *LogEntryData commitCh chan *LogEntryData
cluster *ClusterConfig //cluster
id uint64 //leader
commitCh chan LogEntry
} }
var cluster_config *ClusterConfig var cluster_config *ClusterConfig
...@@ -79,8 +82,18 @@ func (entry *LogEntryData) Committed() bool { ...@@ -79,8 +82,18 @@ func (entry *LogEntryData) Committed() bool {
} }
//make raft implement the append function //make raft implement the append function
//func (raft *Raft) Append(data []byte) (LogEntry, error) { func (raft *Raft) Append(data []byte) (LogEntry, error) {
//} if raft.server.Id != 0 {
return nil, raft.Id
}
temp := LogEntry{1, data, false}
//broadcast to other servers
//wait for acks
//send commit on channel
raft.commitCh <- temp
}
func AppendEntriesRPC()
func NewServerConfig(server_id int) (*ServerConfig, error) { func NewServerConfig(server_id int) (*ServerConfig, error) {
server := new(ServerConfig) server := new(ServerConfig)
......
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