Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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")
Пример #4
0
 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")
Пример #5
0
 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)
Пример #6
0
 def readBucket(self, bucketID):
     if self.useRAM:
         return self._buckets[bucketID - 1]
     else:
         return DBFileSys.readBucket(bucketID, self._segmentSize)
Пример #7
0
 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)
Пример #8
0
 def readBucket(self, bucketID):
     if self.useRAM:
         return self._buckets[bucketID - 1]
     else:
         return DBFileSys.readBucket(bucketID, self._segmentSize)