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

Function WriteEncryptedFileMetadata

cpp/src/parquet/file_writer.cc:650–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void WriteEncryptedFileMetadata(const FileMetaData& file_metadata,
651 ArrowOutputStream* sink,
652 const std::shared_ptr<Encryptor>& encryptor,
653 bool encrypt_footer) {
654 if (encrypt_footer) { // Encrypted file with encrypted footer
655 // encrypt and write to sink
656 file_metadata.WriteTo(sink, encryptor);
657 } else { // Encrypted file with plaintext footer mode.
658 PARQUET_ASSIGN_OR_THROW(int64_t position, sink->Tell());
659 uint32_t metadata_len = static_cast<uint32_t>(position);
660 file_metadata.WriteTo(sink, encryptor);
661 PARQUET_ASSIGN_OR_THROW(position, sink->Tell());
662 metadata_len = static_cast<uint32_t>(position) - metadata_len;
663
664 {
665 uint32_t metadata_len_le = ::arrow::bit_util::ToLittleEndian(metadata_len);
666 PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len_le), 4));
667 }
668 PARQUET_THROW_NOT_OK(sink->Write(kParquetMagic, 4));
669 }
670}
671
672void WriteFileCryptoMetaData(const FileCryptoMetaData& crypto_metadata,
673 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