Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs733
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sushant Mahajan
cs733
Commits
7a0f540c
Commit
7a0f540c
authored
Feb 10, 2015
by
Sushant Mahajan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added KVStore replication code
parent
4948a724
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
assignment2/src/raft/raft.go
assignment2/src/raft/raft.go
+7
-1
assignment2/src/server.go
assignment2/src/server.go
+1
-0
No files found.
assignment2/src/raft/raft.go
View file @
7a0f540c
...
...
@@ -46,7 +46,8 @@ type ClusterConfig struct {
}
type
SharedLog
interface
{
Append
(
data
[]
byte
)
(
LogEntry
,
error
)
Append
(
data
[]
byte
,
conn
net
.
Conn
)
(
LogEntry
,
error
)
AddToChannel
(
entry
LogEntry
)
}
// Raft information
...
...
@@ -216,6 +217,11 @@ func (rft *Raft) Append(data []byte, conn net.Conn) (LogEntry, error) {
return
temp
,
nil
}
//AddToChannel
func
(
rft
*
Raft
)
AddToChannel
(
entry
LogEntry
)
{
rft
.
commitCh
<-
entry
}
func
NewServerConfig
(
serverId
int
)
(
*
ServerConfig
,
error
)
{
server
:=
new
(
ServerConfig
)
server
.
Id
=
serverId
...
...
assignment2/src/server.go
View file @
7a0f540c
...
...
@@ -79,6 +79,7 @@ func (t *AppendEntries) AppendEntriesRPC(args *raft.LogEntryData, reply *Reply)
func
(
t
*
AppendEntries
)
CommitRPC
(
args
*
raft
.
LogEntryData
,
reply
*
Reply
)
error
{
Info
.
Println
(
"Commit RPC invoked"
)
rft
.
LogArray
[(
*
args
)
.
GetLsn
()]
.
SetCommitted
(
true
)
rft
.
AddToChannel
(
args
)
reply
.
X
=
1
return
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment