Commit ac0e6a8b by Krishnan Sanjay

Update ooc.py

parent e42daf01
Showing with 14 additions and 3 deletions
......@@ -66,13 +66,20 @@ class MemoryLimitedHashMap(object):
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.
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):
return self.diskfile+"/"+str(k)+ "_" + subkey
......@@ -81,6 +88,10 @@ class MemoryLimitedHashMap(object):
key = k.split("_")[0]
return key
def path2Subkey(self, k):
key = k.split("_")
return key
def flushKey(self, k, subkey=""):
'''
Removes the key from the dictionary and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment