示例#1
0
文件: block.py 项目: regiontog/rab
    def from_key(cls, key):
        logger.debug("Getting block %s from database", hex(key))
        with blocks as con:
            blob = _get(con, key, select="value", frm="hashmap", where="key")
            size = _get(con, key, select="size" , frm="hashmap", where="key")

        return cls(blob, size, key)
示例#2
0
文件: snapshot.py 项目: regiontog/rab
    def _create_record(self):
        tuple = os.path.basename(self.path), self.path

        with snapshot as con:
            con.execute("REPLACE INTO file(name, path) VALUES(?, ?)", tuple)
            return _get(con, self.path, select="id", frm="file", where="path")
示例#3
0
文件: snapshot.py 项目: regiontog/rab
    def from_path(cls, path):
        with snapshot as con:
            id = _get(con, path, select="id", frm="file", where="path")

        return cls(path, id)
示例#4
0
文件: snapshot.py 项目: regiontog/rab
    def from_id(cls, id):
        with snapshot as con:
            path = _get(con, id, select="path", frm="file", where="id")

        return cls(path, id)