예제 #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)