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
9cee4e2d
Commit
9cee4e2d
authored
Nov 21, 2021
by
mayankkakad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
errors rectified
parent
731414cf
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
980 additions
and
314 deletions
+980
-314
LFU.h
LFU.h
+8
-9
dns.cpp
dns.cpp
+6
-0
server.cpp
server.cpp
+966
-305
No files found.
LFU.h
View file @
9cee4e2d
...
...
@@ -330,6 +330,11 @@ public:
cout
<<
endl
;
}
int
hash
(
string
s
)
{
return
(((
int
)
s
.
at
(
0
))
<<
8
)
+
((
int
)
s
.
at
(
1
));
}
string
getKeyValuePairs
(
int
id
)
{
unordered_map
<
string
,
string
>
flush
;
...
...
@@ -379,15 +384,9 @@ public:
closedir
(
dirFile
);
}
Node
*
temp
=
head
->
next
;
while
(
temp
->
next
)
{
if
(
hash
(
temp
->
key
)
<=
id
)
{
flush
[
temp
->
key
]
=
temp
->
payload
;
}
temp
=
temp
->
next
;
}
for
(
int
i
=
0
;
i
<=
curr_pos
;
i
++
)
if
(
hash
(
cacheHeap
[
i
]
->
key
)
<=
id
)
flush
[
cacheHeap
[
i
]
->
key
]
=
cacheHeap
[
i
]
->
value
;
unordered_map
<
string
,
string
>::
iterator
itr
;
for
(
itr
=
flush
.
begin
();
itr
!=
flush
.
end
();
itr
++
)
...
...
dns.cpp
View file @
9cee4e2d
...
...
@@ -186,7 +186,13 @@ private:
RequestType
reqType
;
};
void
signalHandler
(
int
signum
)
{
remove
(
SERVERS
);
exit
(
0
);
}
int
main
(
int
argc
,
char
**
argv
)
{
signal
(
SIGINT
,
signalHandler
);
srand
(
time
(
0
));
string
server_address
(
"0.0.0.0:1234"
);
builder
.
AddListeningPort
(
server_address
,
grpc
::
InsecureServerCredentials
());
...
...
server.cpp
View file @
9cee4e2d
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