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
503288eb
Commit
503288eb
authored
Nov 20, 2021
by
Vishal Saha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented , on sharing of keys cache keys from old server deleted
parent
27fec107
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
LFU.h
LFU.h
+15
-5
No files found.
LFU.h
View file @
503288eb
...
...
@@ -330,6 +330,10 @@ 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,14 +383,20 @@ public:
closedir
(
dirFile
);
}
Node
*
temp
=
head
->
next
;
while
(
temp
->
next
)
vector
<
string
>
toBeDeleted
;
for
(
int
i
=
0
;
i
<=
curr_pos
;
i
++
)
{
if
(
hash
(
temp
->
key
)
<=
id
)
if
(
hash
(
cacheHeap
[
i
]
->
key
)
<=
id
)
{
flush
[
temp
->
key
]
=
temp
->
payload
;
toBeDeleted
.
push_back
(
cacheHeap
[
i
]
->
key
);
flush
[
cacheHeap
[
i
]
->
key
]
=
cacheHeap
[
i
]
->
value
;
}
temp
=
temp
->
next
;
}
for
(
string
key
:
toBeDeleted
)
{
this
->
deleteNodeByKey
(
key
);
}
unordered_map
<
string
,
string
>::
iterator
itr
;
...
...
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