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
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))
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
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]
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]
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]
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]
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)
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)