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