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

Method CloseEncryptedFile

cpp/src/parquet/file_writer.cc:480–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478 }
479
480 void CloseEncryptedFile(FileEncryptionProperties* file_encryption_properties) {
481 // Encrypted file with encrypted footer
482 if (file_encryption_properties->encrypted_footer()) {
483 // encrypted footer
484 file_metadata_ = metadata_->Finish(key_value_metadata_);
485
486 PARQUET_ASSIGN_OR_THROW(int64_t position, sink_->Tell());
487 uint64_t metadata_start = static_cast<uint64_t>(position);
488 auto crypto_metadata = metadata_->GetCryptoMetaData();
489 WriteFileCryptoMetaData(*crypto_metadata, sink_.get());
490
491 auto footer_encryptor = file_encryptor_->GetFooterEncryptor();
492 WriteEncryptedFileMetadata(*file_metadata_, sink_.get(), footer_encryptor, true);
493 PARQUET_ASSIGN_OR_THROW(position, sink_->Tell());
494 uint32_t footer_and_crypto_len = static_cast<uint32_t>(position - metadata_start);
495 uint32_t footer_and_crypto_len_le =
496 ::arrow::bit_util::ToLittleEndian(footer_and_crypto_len);
497 PARQUET_THROW_NOT_OK(
498 sink_->Write(reinterpret_cast<uint8_t*>(&footer_and_crypto_len_le), 4));
499 PARQUET_THROW_NOT_OK(sink_->Write(kParquetEMagic, 4));
500 } else { // Encrypted file with plaintext footer
501 file_metadata_ = metadata_->Finish(key_value_metadata_);
502 auto footer_signing_encryptor = file_encryptor_->GetFooterSigningEncryptor();
503 WriteEncryptedFileMetadata(*file_metadata_, sink_.get(), footer_signing_encryptor,
504 false);
505 }
506 }
507
508 void WritePageIndex() {
509 if (page_index_builder_ != nullptr) {

Callers

nothing calls this directly

Calls 10

WriteFileCryptoMetaDataFunction · 0.85
GetCryptoMetaDataMethod · 0.80
GetFooterEncryptorMethod · 0.80
ToLittleEndianFunction · 0.70
FinishMethod · 0.45
getMethod · 0.45
TellMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected