Esempio n. 1
0
 def _require_file_exists(self, gen_number, filename):
     generation = self._lookup_generation_by_gen_number(gen_number)
     if filename not in generation['files']:
         raise obnamlib.RepositoryFileDoesNotExistInGeneration(
             client_name=self._client_name,
             genspec=gen_number,
             filename=filename)
Esempio n. 2
0
 def _require_file_exists(self, gen_number, filename):
     generation = self._lookup_generation_by_gen_number(gen_number)
     metadata = generation.get_file_metadata()
     if not metadata.file_exists(filename):
         raise obnamlib.RepositoryFileDoesNotExistInGeneration(
             client_name=self._client_name,
             genspec=gen_number,
             filename=filename)
Esempio n. 3
0
 def clear_file_chunk_ids(self, gen_number, filename):
     self._load_data()
     generation = self._lookup_generation_by_gen_number(gen_number)
     metadata = generation.get_file_metadata()
     if not metadata.clear_file_chunk_ids(filename):
         raise obnamlib.RepositoryFileDoesNotExistInGeneration(
             client_name=self._client_name,
             genspec=gen_number,
             filename=filename)
Esempio n. 4
0
    def set_file_keys_from_metadata(self, gen_number, filename, file_metadata):
        self._load_data()

        generation = self._lookup_generation_by_gen_number(gen_number)
        metadata = generation.get_file_metadata()
        if not metadata.set_file_keys_from_metadata(filename, file_metadata):
            raise obnamlib.RepositoryFileDoesNotExistInGeneration(
                client_name=self._client_name,
                genspec=gen_number,
                filename=filename)
Esempio n. 5
0
 def get_metadata_from_file_keys(self, gen_number, filename):
     self._load_data()
     generation = self._lookup_generation_by_gen_number(gen_number)
     metadata_obj = generation.get_file_metadata()
     if not metadata_obj.file_exists(filename):
         raise obnamlib.RepositoryFileDoesNotExistInGeneration(
             client_name=self._client_name,
             genspec=gen_number,
             filename=filename)
     return metadata_obj.get_metadata_from_file_keys(filename)
Esempio n. 6
0
 def get_file_children(self, gen_number, filename):
     self._load_data()
     generation = self._lookup_generation_by_gen_number(gen_number)
     metadata = generation.get_file_metadata()
     result = metadata.get_file_children(filename)
     if result is None:
         raise obnamlib.RepositoryFileDoesNotExistInGeneration(
             client_name=self._client_name,
             genspec=gen_number,
             filename=filename)
     return result
Esempio n. 7
0
    def _require_existing_file(self, generation_id, filename):
        client_name, _ = self._unpack_gen_id(generation_id)

        if generation_id not in self.get_client_generation_ids(client_name):
            raise obnamlib.RepositoryGenerationDoesNotExist(
                client_name=client_name, gen_id=generation_id)

        if not self.file_exists(generation_id, filename):
            raise obnamlib.RepositoryFileDoesNotExistInGeneration(
                client_name=client_name,
                genspec=self.make_generation_spec(generation_id),
                filename=filename)
Esempio n. 8
0
 def _require_file(self, gen_id, filename):
     if not self.file_exists(gen_id, filename):
         raise obnamlib.RepositoryFileDoesNotExistInGeneration(
             client_name=self.name,
             genspec=self.make_generation_spec(gen_id),
             filename=filename)