Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS744 DECS-PA4-KEYVALUE-SERVER
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kamal Khodabhai
CS744 DECS-PA4-KEYVALUE-SERVER
Commits
2cf6ddb2
Commit
2cf6ddb2
authored
Nov 21, 2021
by
mayankkakad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
errors rectified
parent
9cee4e2d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
client.cpp
client.cpp
+1
-0
server.cpp
server.cpp
+9
-5
No files found.
client.cpp
View file @
2cf6ddb2
...
...
@@ -160,6 +160,7 @@ void RunClient() {
Info
info
;
ClientContext
context
;
Status
status
=
stub
->
GETADDRESS
(
&
context
,
null
,
&
info
);
std
::
cout
<<
"Server: "
<<
info
.
address
()
<<
std
::
endl
;
std
::
string
target_address
(
info
.
address
());
// Instantiates the client
KeyValueServicesClient
client
(
...
...
server.cpp
View file @
2cf6ddb2
...
...
@@ -337,7 +337,7 @@ public:
//return half of the keyvalue pairs to the requesting node
string
address
=
info
.
address
();
int
id
=
stoi
(
address
.
substr
(
address
.
find
(
':'
)
+
1
));
string
keyvalues
=
memManager
->
getKeyValuePairs
(
id
);
string
keyvalues
=
memManager
->
getKeyValuePairs
(
id
,
stoi
(
params
[
"LISTENING_PORT"
])
);
string
keys
=
keyvalues
.
substr
(
0
,
keyvalues
.
find
(
";;"
)
+
1
);
string
values
=
keyvalues
.
substr
(
keyvalues
.
find
(
";;"
)
+
2
);
cout
<<
"Okay, my new predecessor is: "
<<
info
.
address
()
<<
endl
;
...
...
@@ -1041,15 +1041,19 @@ public:
int
my_id
=
stoi
(
params
.
find
(
"LISTENING_PORT"
)
->
second
);
ifstream
fin
;
fin
.
open
(
NEIGHBOURS
);
string
pred
;
getline
(
fin
,
pred
);
string
pred
,
scc
;
getline
(
fin
,
scc
);
getline
(
fin
,
pred
);
fin
.
close
();
int
pred_id
;
int
pred_id
,
succ_id
;
if
(
pred
==
"-1"
)
pred_id
=-
1
;
else
pred_id
=
stoi
(
pred
.
substr
(
pred
.
find
(
':'
)
+
1
));
if
(
scc
==
"-1"
)
succ_id
=-
1
;
else
succ_id
=
stoi
(
scc
.
substr
(
scc
.
find
(
':'
)
+
1
));
if
(
my_id
<
key_id
&&!
(
pred_id
<
key_id
&&
pred_id
>
my_id
))
{
//transfer request
int
fingers
[
16
];
...
...
@@ -1226,7 +1230,7 @@ public:
stat
.
set_status
(
200
);
}
else
{
if
(
pred_id
==-
1
||
pred_id
<
key_id
)
{
if
(
pred_id
==-
1
||
(
pred_id
<
key_id
&&
my_id
>=
key_id
)
||
(
pred_id
>
my_id
&&
my_id
>=
key_id
)
)
{
cout
<<
"SERVER SERVES A PUT REQUEST WITH PARAMETER KEY : "
<<
keyvalue
.
key
()
<<
" & VALUE : "
<<
keyvalue
.
value
()
<<
endl
;
...
...
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