Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishnan Sanjay
/
cmsc13600-public
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ac0e6a8b
authored
Jun 02, 2020
by
Krishnan Sanjay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ooc.py
parent
e42daf01
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
hw5/ooc.py
hw5/ooc.py
View file @
ac0e6a8b
...
@@ -66,13 +66,20 @@ class MemoryLimitedHashMap(object):
...
@@ -66,13 +66,20 @@ class MemoryLimitedHashMap(object):
return
set
([
k
for
k
in
self
.
_data
])
return
set
([
k
for
k
in
self
.
_data
])
def
flushed
(
self
):
def
flushed
(
self
,
returnSubKeys
=
False
):
'''
'''
Returns a set over keys that have been flushed.
Returns a set over keys that have been flushed.
Tuple is (key, location)
Tuple is (key, location)
if returnSubKeys=True
The tuple is ((key,subkey), location), if no subkey is provided it's just
(key)
'''
'''
return
set
([
self
.
path2Key
(
k
)
for
k
in
os
.
listdir
(
self
.
diskfile
)])
if
not
returnSubKeys
:
return
set
([
self
.
path2Key
(
k
)
for
k
in
os
.
listdir
(
self
.
diskfile
)])
else
:
return
set
([
self
.
path2Subkey
(
k
)
for
k
in
os
.
listdir
(
self
.
diskfile
)])
def
keyPath
(
self
,
k
,
subkey
):
def
keyPath
(
self
,
k
,
subkey
):
return
self
.
diskfile
+
"/"
+
str
(
k
)
+
"_"
+
subkey
return
self
.
diskfile
+
"/"
+
str
(
k
)
+
"_"
+
subkey
...
@@ -81,6 +88,10 @@ class MemoryLimitedHashMap(object):
...
@@ -81,6 +88,10 @@ class MemoryLimitedHashMap(object):
key
=
k
.
split
(
"_"
)[
0
]
key
=
k
.
split
(
"_"
)[
0
]
return
key
return
key
def
path2Subkey
(
self
,
k
):
key
=
k
.
split
(
"_"
)
return
key
def
flushKey
(
self
,
k
,
subkey
=
""
):
def
flushKey
(
self
,
k
,
subkey
=
""
):
'''
'''
Removes the key from the dictionary and
Removes the key from the dictionary and
...
...
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