def writeBucket(self, bucketID, blocks): if self.useRAM: if bucketID > len(self._buckets): self._buckets.append(blocks) else: self._buckets[bucketID - 1] = blocks else: DBFileSys.writeBucket(bucketID, blocks, self._segmentSize)
def readEverything(self): if DBFileSys.readStash(self._segSize) == "new ORAM": # if the files don't exist yet, then write everything self.writeEverything() self.readEverything() print("New ORAM Created") else: self._oram.setStash(DBFileSys.readStash(self._segSize)) self._oram.setPosMap(DBFileSys.readDictionary("posMap")) self._segSizeMap = DBFileSys.readDictionary("segSizeMap") self._segIDMap = DBFileSys.readDictionary("segIDMap")
def readEverything(self): if DBFileSys.readStash( self._segSize ) == "new ORAM": # if the files don't exist yet, then write everything self.writeEverything() self.readEverything() print("New ORAM Created") else: self._oram.setStash(DBFileSys.readStash(self._segSize)) self._oram.setPosMap(DBFileSys.readDictionary("posMap")) self._segSizeMap = DBFileSys.readDictionary("segSizeMap") self._segIDMap = DBFileSys.readDictionary("segIDMap")
def writeEverything(self): DBFileSys.writeStash( self._oram.getStash().getNodes(), self._segSize ) # I shouldn't access private member variables right? DBFileSys.writeDictionary("posMap", self._oram.getPosMap().getMap()) DBFileSys.writeDictionary("segSizeMap", self._segSizeMap) DBFileSys.writeDictionary("segIDMap", self._segIDMap)
def readBucket(self, bucketID): if self.useRAM: return self._buckets[bucketID - 1] else: return DBFileSys.readBucket(bucketID, self._segmentSize)
def writeEverything(self): DBFileSys.writeStash(self._oram.getStash().getNodes( ), self._segSize) # I shouldn't access private member variables right? DBFileSys.writeDictionary("posMap", self._oram.getPosMap().getMap()) DBFileSys.writeDictionary("segSizeMap", self._segSizeMap) DBFileSys.writeDictionary("segIDMap", self._segIDMap)