MCPcopy Create free account
hub / github.com/apple/foundationdb / finalize

Method finalize

fdbclient/BlobGranuleFiles.cpp:343–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341 }
342
343 void finalize(Optional<BlobGranuleCipherKeysCtx> cipherKeysCtx, Arena& arena) {
344 if (cipherKeysCtx.present()) {
345 // IndexBlock childBlock pointers offsets are relative to IndexBlock endOffset instead of file start offset.
346 // Compressing indexBlock will need offset recalculation (circular depedency). IndexBlock size is bounded by
347 // number of chunks and sizeof(KeyPrefix), 'not' compressing IndexBlock shouldn't cause significant file
348 // size bloat.
349
350 ASSERT(cipherKeysCtx.present());
351 encrypt(cipherKeysCtx.get(), arena);
352 } else {
353 encryptHeaderRef.reset();
354 buffer = StringRef(
355 arena, ObjectWriter::toValue(block, IncludeVersion(ProtocolVersion::withBlobGranuleFile())).contents());
356 }
357
358 if (BG_ENCRYPT_COMPRESS_DEBUG) {
359 TraceEvent(SevDebug, "IndexBlockSize")
360 .detail("Sz", buffer.size())
361 .detail("Encrypted", cipherKeysCtx.present());
362 }
363 }
364
365 template <class Ar>
366 void serialize(Ar& ar) {

Callers 1

serializeIndexBlockFunction · 0.45

Calls 9

encryptFunction · 0.85
IncludeVersionFunction · 0.85
TraceEventClass · 0.85
detailMethod · 0.80
getMethod · 0.65
StringRefClass · 0.50
presentMethod · 0.45
resetMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected