MCPcopy Create free account
hub / github.com/apache/arrow / WriteEncryptedFileMetadata

Function WriteEncryptedFileMetadata

cpp/src/parquet/file_writer.cc:632–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632void WriteEncryptedFileMetadata(const FileMetaData& file_metadata,
633 ArrowOutputStream* sink,
634 const std::shared_ptr<Encryptor>& encryptor,
635 bool encrypt_footer) {
636 if (encrypt_footer) { // Encrypted file with encrypted footer
637 // encrypt and write to sink
638 file_metadata.WriteTo(sink, encryptor);
639 } else { // Encrypted file with plaintext footer mode.
640 PARQUET_ASSIGN_OR_THROW(int64_t position, sink->Tell());
641 uint32_t metadata_len = static_cast<uint32_t>(position);
642 file_metadata.WriteTo(sink, encryptor);
643 PARQUET_ASSIGN_OR_THROW(position, sink->Tell());
644 metadata_len = static_cast<uint32_t>(position) - metadata_len;
645
646 {
647 uint32_t metadata_len_le = ::arrow::bit_util::ToLittleEndian(metadata_len);
648 PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len_le), 4));
649 }
650 PARQUET_THROW_NOT_OK(sink->Write(kParquetMagic, 4));
651 }
652}
653
654void WriteFileCryptoMetaData(const FileCryptoMetaData& crypto_metadata,
655 ArrowOutputStream* sink) {

Callers 1

CloseEncryptedFileMethod · 0.85

Calls 4

ToLittleEndianFunction · 0.70
WriteToMethod · 0.45
TellMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected