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
1ce65632
Commit
1ce65632
authored
Feb 04, 2015
by
Harshit Pande
Browse files
Options
Browse Files
Download
Plain Diff
continuing with shared log
parents
ccfd990e
2387bf11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
assignment2/replic_kvstore.go
assignment2/replic_kvstore.go
+18
-6
No files found.
assignment2/replic_kvstore.go
View file @
1ce65632
...
@@ -28,7 +28,15 @@ type ClusterConfig struct {
...
@@ -28,7 +28,15 @@ type ClusterConfig struct {
}
}
type
SharedLogData
struct
{
type
SharedLogData
struct
{
LogEntryData
[]
LogEntryData
[]
log_array
}
type
ErrRedirect
int
var
cluster_config
*
ClusterConfig
func
(
log
*
SharedLogData
)
Append
(
data
[]
byte
)
(
LogEntry
,
error
)
{
}
}
func
NewServerConfig
(
server_id
int
)
(
*
ServerConfig
,
error
)
{
func
NewServerConfig
(
server_id
int
)
(
*
ServerConfig
,
error
)
{
...
@@ -41,16 +49,20 @@ func NewServerConfig(server_id int) (*ServerConfig, error) {
...
@@ -41,16 +49,20 @@ func NewServerConfig(server_id int) (*ServerConfig, error) {
}
}
func
NewClusterConfig
(
num_servers
int
)
(
*
ClusterConfig
,
error
)
{
func
NewClusterConfig
(
num_servers
int
)
(
*
ClusterConfig
,
error
)
{
c
luster_c
onfig
:=
new
(
ClusterConfig
)
config
:=
new
(
ClusterConfig
)
c
luster_c
onfig
.
Path
=
""
config
.
Path
=
""
c
luster_c
onfig
.
Servers
=
make
([]
ServerConfig
,
num_servers
)
config
.
Servers
=
make
([]
ServerConfig
,
num_servers
)
for
i
:=
1
;
i
<=
num_servers
;
i
++
{
for
i
:=
1
;
i
<=
num_servers
;
i
++
{
curr_server
,
_
:=
NewServerConfig
(
i
)
curr_server
,
_
:=
NewServerConfig
(
i
)
c
luster_c
onfig
.
Servers
[
i
-
1
]
=
*
(
curr_server
)
config
.
Servers
[
i
-
1
]
=
*
(
curr_server
)
}
}
return
cluster_config
,
nil
return
config
,
nil
}
func
(
e
ErrRedirect
)
Error
()
string
{
return
"Redirect to server "
+
strconv
.
Itoa
(
cluster_config
.
Servers
[
0
]
.
Id
)
}
}
func
main
()
{
func
main
()
{
...
...
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