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
a40a6241
Commit
a40a6241
authored
Feb 05, 2015
by
Sushant Mahajan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.cse.iitb.ac.in:smahajan/cs733
parents
8051e299
a2ea0ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
assignment2/replic_kvstore.go
assignment2/replic_kvstore.go
+19
-0
No files found.
assignment2/replic_kvstore.go
View file @
a40a6241
...
...
@@ -84,6 +84,25 @@ func monitor_commitCh(c <-chan LogEntry) { //unidirectional -- can only read fro
}
}
//goroutine that monitors channel to check if the majority of servers have replied
func
monitor_ackCh
(
rft
*
Raft
,
ack_ch
<-
chan
int
,
log_entry
LogEntry
)
{
acks_received
:=
0
num_servers
:=
len
(
rft
.
cluster_config
.
Servers
)
required_acks
:=
num_servers
/
2
if
num_servers
%
2
==
0
{
required_acks
++
}
for
{
temp
:=
<-
ack_ch
acks_received
+=
temp
if
acks_received
==
required_acks
{
rft
.
commitCh
<-
log_entry
break
}
}
}
//make LogEntryData implement the
func
(
entry
*
LogEntryData
)
Lsn
()
Lsn
{
return
entry
.
id
...
...
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