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
e0a060fd
Commit
e0a060fd
authored
Feb 04, 2015
by
Sushant Mahajan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completed reaft structure and started append
parent
cab533d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
assignment2/replic_kvstore.go
assignment2/replic_kvstore.go
+17
-5
No files found.
assignment2/replic_kvstore.go
View file @
e0a060fd
...
...
@@ -26,7 +26,7 @@ type LogEntry interface {
}
type
LogEntryData
struct
{
id
uint64
id
Lsn
data
[]
byte
committed
bool
}
...
...
@@ -48,13 +48,15 @@ type SharedLog interface {
}
type
Raft
struct
{
//some good stuff needs to go here
cluster
*
ClusterConfig
//cluster
id
uint64
//leader
commitCh
chan
LogEntry
}
var
cluster_config
*
ClusterConfig
//make LogEntryData implement the
func
(
entry
*
LogEntryData
)
Lsn
()
uint64
{
func
(
entry
*
LogEntryData
)
Lsn
()
Lsn
{
return
entry
.
id
}
...
...
@@ -67,8 +69,18 @@ func (entry *LogEntryData) Committed() bool {
}
//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
)
{
server
:=
new
(
ServerConfig
)
...
...
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