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
45626f12
You need to sign in or sign up before continuing.
Commit
45626f12
authored
Nov 17, 2021
by
mayankkakad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new server adding code done (untested)
parent
178250d5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
285 additions
and
18 deletions
+285
-18
dns.cpp
dns.cpp
+7
-3
keyvaluestore.proto
keyvaluestore.proto
+11
-2
server.cpp
server.cpp
+267
-13
No files found.
dns.cpp
View file @
45626f12
...
@@ -22,7 +22,8 @@ std::unique_ptr<Server> server;
...
@@ -22,7 +22,8 @@ std::unique_ptr<Server> server;
enum
RequestType
{
enum
RequestType
{
GETADDRESS
,
GETADDRESS
,
ADDADDRESS
ADDADDRESS
,
UPDATEFINGERTABLES
};
};
class
DNSData
{
class
DNSData
{
...
@@ -36,7 +37,7 @@ public:
...
@@ -36,7 +37,7 @@ public:
status
=
PROCESS
;
status
=
PROCESS
;
if
(
reqType
==
GETADDRESS
)
if
(
reqType
==
GETADDRESS
)
service
->
RequestGETADDRESS
(
&
context
,
&
null
,
&
getAddressResponder
,
cq
,
cq
,
this
);
service
->
RequestGETADDRESS
(
&
context
,
&
null
,
&
getAddressResponder
,
cq
,
cq
,
this
);
else
else
if
(
reqType
==
ADDADDRESS
)
service
->
RequestADDADDRESS
(
&
context
,
&
info
,
&
addAddressResponder
,
cq
,
cq
,
this
);
service
->
RequestADDADDRESS
(
&
context
,
&
info
,
&
addAddressResponder
,
cq
,
cq
,
this
);
}
}
else
if
(
status
==
PROCESS
)
{
else
if
(
status
==
PROCESS
)
{
...
@@ -62,7 +63,7 @@ public:
...
@@ -62,7 +63,7 @@ public:
}
}
getAddressResponder
.
Finish
(
info
,
Status
::
OK
,
this
);
getAddressResponder
.
Finish
(
info
,
Status
::
OK
,
this
);
}
}
else
{
else
if
(
reqType
==
ADDADDRESS
)
{
ofstream
fout
;
ofstream
fout
;
fout
.
open
(
SERVERS
,
ios
::
app
);
fout
.
open
(
SERVERS
,
ios
::
app
);
fout
<<
info
.
address
()
<<
endl
;
fout
<<
info
.
address
()
<<
endl
;
...
@@ -70,6 +71,8 @@ public:
...
@@ -70,6 +71,8 @@ public:
null
.
set_nothing
(
0
);
null
.
set_nothing
(
0
);
addAddressResponder
.
Finish
(
null
,
Status
::
OK
,
this
);
addAddressResponder
.
Finish
(
null
,
Status
::
OK
,
this
);
}
}
else
{
}
status
=
FINISH
;
status
=
FINISH
;
}
}
else
{
else
{
...
@@ -124,6 +127,7 @@ int main(int argc,char **argv) {
...
@@ -124,6 +127,7 @@ int main(int argc,char **argv) {
cout
<<
"DNS SERVER COMES UP SUCCESSFULLY"
<<
endl
;
cout
<<
"DNS SERVER COMES UP SUCCESSFULLY"
<<
endl
;
new
DNSData
(
&
service
,
comp_queue
.
get
(),
GETADDRESS
);
new
DNSData
(
&
service
,
comp_queue
.
get
(),
GETADDRESS
);
new
DNSData
(
&
service
,
comp_queue
.
get
(),
ADDADDRESS
);
new
DNSData
(
&
service
,
comp_queue
.
get
(),
ADDADDRESS
);
new
DNSData
(
&
service
,
comp_queue
.
get
(),
UPDATEFINGERTABLES
);
void
*
tag
;
void
*
tag
;
bool
ok
;
bool
ok
;
while
(
true
)
{
while
(
true
)
{
...
...
keyvaluestore.proto
View file @
45626f12
...
@@ -9,9 +9,13 @@ service KeyValueServices {
...
@@ -9,9 +9,13 @@ service KeyValueServices {
rpc
PUT
(
KeyValue
)
returns
(
ReqStatus
)
{}
rpc
PUT
(
KeyValue
)
returns
(
ReqStatus
)
{}
rpc
DEL
(
Key
)
returns
(
ReqStatus
)
{}
rpc
DEL
(
Key
)
returns
(
ReqStatus
)
{}
rpc
NEW
(
Info
)
returns
(
SuccessorInfo
)
{}
rpc
NEW
(
Info
)
returns
(
SuccessorInfo
)
{}
rpc
INFORM
(
Info
)
returns
(
KeyValues
)
{}
rpc
INFORMSUCCESSOR
(
Info
)
returns
(
KeyValues
)
{}
rpc
INFORMPREDECESSOR
(
Info
)
returns
(
Null
)
{}
rpc
GETADDRESS
(
Null
)
returns
(
Info
)
{}
rpc
GETADDRESS
(
Null
)
returns
(
Info
)
{}
rpc
ADDADDRESS
(
Info
)
returns
(
Null
)
{}
rpc
ADDADDRESS
(
Info
)
returns
(
Null
)
{}
rpc
UPDATEFINGERTABLES
(
Null
)
returns
(
Null
)
{}
rpc
GETSUCCESSOR
(
Id
)
returns
(
Id
)
{}
rpc
GETPREDECESSOR
(
Id
)
returns
(
Id
)
{}
}
}
message
Key
{
message
Key
{
...
@@ -39,7 +43,8 @@ message Info {
...
@@ -39,7 +43,8 @@ message Info {
}
}
message
SuccessorInfo
{
message
SuccessorInfo
{
string
address
=
1
;
string
succaddress
=
1
;
string
predaddress
=
2
;
}
}
message
KeyValues
{
message
KeyValues
{
...
@@ -49,4 +54,8 @@ message KeyValues {
...
@@ -49,4 +54,8 @@ message KeyValues {
message
Null
{
message
Null
{
int32
nothing
=
1
;
int32
nothing
=
1
;
}
message
Id
{
int64
id
=
1
;
}
}
\ No newline at end of file
server.cpp
View file @
45626f12
This diff is collapsed.
Click to expand it.
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