def writeMetadata(self, updated, dry_run=False): # remember to set the callback obejct if not dry_run: updated.write(struct.pack("I", 0)) updated.write(struct.pack("I", self.id)) outString(updated, 260, self.name) updated.write(struct.pack("I", 0)) if self.compressed: self.compr_object.aftercompress_callback_obj = compression.after_comp_callback(updated.tell(), updated) if not dry_run: updated.write(struct.pack("I", self.comp_size)) updated.write(struct.pack("I", self.size)) compa = 0 if self.compressed: compa = 1 updated.write(struct.pack("I", compa)) self.offset_writeback_location = updated.tell() updated.write(struct.pack("I", self.offset))
def write_out_metadata(self, updated, dry_run=False): """ Write a copy of the metadata to a file :param updated: file object :param dry_run: :return: """ if not dry_run: updated.write(struct.pack("I", 0)) updated.write(struct.pack("I", self.id)) put_string(updated, 260, self.name) updated.write(struct.pack("I", 0)) if self.compressed: self.compr_object.aftercompress_callback_obj = compression.after_comp_callback(updated.tell(), updated) if not dry_run: updated.write(struct.pack("I", self.comp_size)) updated.write(struct.pack("I", self.size)) compa = 0 if self.compressed: compa = 1 updated.write(struct.pack("I", compa)) self.offset_writeback_location = updated.tell() # save the updated.write(struct.pack("I", self.offset))
def write_out_metadata(self, updated, dry_run=False): """ Write a copy of the metadata to a file :param updated: file object :param dry_run: :return: """ if not dry_run: updated.write(struct.pack("I", 0)) updated.write(struct.pack("I", self.id)) put_string(updated, 260, self.name) updated.write(struct.pack("I", 0)) if self.compressed: self.compr_object.aftercompress_callback_obj = compression.after_comp_callback( updated.tell(), updated) if not dry_run: updated.write(struct.pack("I", self.comp_size)) updated.write(struct.pack("I", self.size)) compa = 0 if self.compressed: compa = 1 updated.write(struct.pack("I", compa)) self.offset_writeback_location = updated.tell() # save the updated.write(struct.pack("I", self.offset))