Ejemplo n.º 1
0
class RuntimeTreeStorage(object):
    def __init__(self, db_path):
        self.__db = KVDatabase(db_path)

    def save(self, runtime_tree):
        self.__db.set(runtime_tree.id, runtime_tree.dumps())

    def find(self, id):
        d = self.__db.get(id)
        return RuntimeTree.loads(d) if d is not None else None

    def remove(self, id):
        self.__db.unset(id)

    def remove_all(self):
        self.__db.clear()
Ejemplo n.º 2
0
 def __init__(self, db_path):
     self.__db = KVDatabase(db_path)