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

Method fromFileBytes

fdbclient/BlobGranuleFiles.cpp:574–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572 }
573
574 static Standalone<IndexedBlobGranuleFile> fromFileBytes(const StringRef& fileBytes,
575 const Optional<BlobGranuleCipherKeysCtx> cipherKeysCtx) {
576 // parse index block at head of file
577 Arena arena;
578 IndexedBlobGranuleFile file;
579 ObjectReader dataReader(fileBytes.begin(), IncludeVersion());
580 dataReader.deserialize(FileIdentifierFor<IndexedBlobGranuleFile>::value, file, arena);
581
582 file.init(fileBytes, arena, cipherKeysCtx);
583
584 // do sanity checks
585 if (file.formatVersion > LATEST_BG_FORMAT_VERSION || file.formatVersion < MIN_SUPPORTED_BG_FORMAT_VERSION) {
586 TraceEvent(SevWarn, "BlobGranuleFileInvalidFormatVersion")
587 .suppressFor(5.0)
588 .detail("FoundFormatVersion", file.formatVersion)
589 .detail("MinSupported", MIN_SUPPORTED_BG_FORMAT_VERSION)
590 .detail("LatestSupported", LATEST_BG_FORMAT_VERSION);
591 throw unsupported_format_version();
592 }
593 ASSERT(file.fileType == SNAPSHOT_FILE_TYPE || file.fileType == DELTA_FILE_TYPE);
594
595 return Standalone<IndexedBlobGranuleFile>(file, arena);
596 }
597
598 ChildBlockPointerRef* findStartBlock(const KeyRef& beginKey) const {
599 ChildBlockPointerRef searchKey(beginKey, 0);

Callers

nothing calls this directly

Calls 6

IncludeVersionFunction · 0.85
TraceEventClass · 0.85
detailMethod · 0.80
beginMethod · 0.45
deserializeMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected