コード例 #1
0
ファイル: chunk_store.py プロジェクト: nom3ad/obnam
 def get_chunk_content(self, chunk_id):
     content = self._blob_store.get_blob(chunk_id)
     if content is None:
         raise obnamlib.RepositoryChunkDoesNotExist(
             chunk_id=chunk_id,
             filename=None)
     return content
コード例 #2
0
ファイル: repo_fmt_6.py プロジェクト: dfries/obnam
    def remove_chunk(self, chunk_id):
        tracing.trace('chunk_id=%s', chunk_id)

        # Note: we ignore in-tree data, on the assumption that if
        # it gets removed, the whole file gets removed from the
        # generation anyway. This should probably be fixed some day.
        if self._is_in_tree_chunk_id(chunk_id):  # pragma: no cover
            return

        filename = self._chunk_filename(chunk_id)
        try:
            self._fs.remove(filename)
        except OSError:
            raise obnamlib.RepositoryChunkDoesNotExist(chunk_id=str(chunk_id))
コード例 #3
0
ファイル: repo_fmt_6.py プロジェクト: dfries/obnam
    def get_chunk_content(self, chunk_id):
        if self._is_in_tree_chunk_id(chunk_id):  # pragma: no cover
            gen_id, filename = self._unpack_in_tree_chunk_id(chunk_id)
            client_name, gen_number = self._unpack_gen_id(gen_id)
            client = self._open_client(client_name)
            return client.get_file_data(gen_number, filename)

        try:
            return self._fs.cat(self._chunk_filename(chunk_id))
        except IOError, e:
            if e.errno == errno.ENOENT:
                raise obnamlib.RepositoryChunkDoesNotExist(
                    chunk_id=str(chunk_id))
            raise  # pragma: no cover
コード例 #4
0
 def remove_chunk(self, chunk_id):
     if chunk_id not in self.chunks:
         raise obnamlib.RepositoryChunkDoesNotExist(chunk_id=str(chunk_id))
     del self.chunks[chunk_id]
コード例 #5
0
 def get_chunk_content(self, chunk_id):
     if chunk_id not in self.chunks:
         raise obnamlib.RepositoryChunkDoesNotExist(chunk_id=str(chunk_id))
     return self.chunks[chunk_id]
コード例 #6
0
 def remove_chunk(self, chunk_id):
     if chunk_id not in self.chunks:
         raise obnamlib.RepositoryChunkDoesNotExist(
             chunk_id=str(chunk_id),
             filename='(no chunk files in this format')
     del self.chunks[chunk_id]
コード例 #7
0
 def get_chunk_content(self, chunk_id):
     if chunk_id not in self.chunks:
         raise obnamlib.RepositoryChunkDoesNotExist(
             chunk_id=str(chunk_id),
             filename='(no chunk files in this format')
     return self.chunks[chunk_id]
コード例 #8
0
ファイル: simple.py プロジェクト: secmff/obnam
 def remove_chunk(self, chunk_id):
     filename = self._chunk_filename(chunk_id)
     if not self._fs.exists(filename):
         raise obnamlib.RepositoryChunkDoesNotExist(chunk_id=chunk_id,
                                                    filename=filename)
     self._fs.remove(filename)
コード例 #9
0
ファイル: simple.py プロジェクト: secmff/obnam
 def get_chunk_content(self, chunk_id):
     filename = self._chunk_filename(chunk_id)
     if not self._fs.exists(filename):
         raise obnamlib.RepositoryChunkDoesNotExist(chunk_id=chunk_id,
                                                    filename=filename)
     return self._fs.cat(filename)