MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / validateMagicBytes

Function validateMagicBytes

src/storage/database_header.cpp:34–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34static void validateMagicBytes(common::Deserializer& deSer) {
35 std::string key;
36 deSer.validateDebuggingInfo(key, "magic");
37 const auto numMagicBytes = strlen(StorageVersionInfo::MAGIC_BYTES);
38 uint8_t magicBytes[4];
39 for (auto i = 0u; i < numMagicBytes; i++) {
40 deSer.deserializeValue<uint8_t>(magicBytes[i]);
41 }
42 if (memcmp(magicBytes, StorageVersionInfo::MAGIC_BYTES, numMagicBytes) != 0) {
43 throw common::RuntimeException(
44 "Unable to open database. The file is not a valid Lbug database file!");
45 }
46}
47
48void DatabaseHeader::updateCatalogPageRange(PageManager& pageManager, PageRange newPageRange) {
49 if (catalogPageRange.startPageIdx != common::INVALID_PAGE_IDX) {

Callers 1

deserializeMethod · 0.85

Calls 1

validateDebuggingInfoMethod · 0.80

Tested by

no test coverage detected