-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1436 from kuzudb/version-number
Add storage version info
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "exception" | ||
#include <string> | ||
|
||
#include "common/utils.h" | ||
|
||
namespace kuzu { | ||
namespace storage { | ||
|
||
using storage_version_t = uint64_t; | ||
|
||
struct StorageVersionInfo { | ||
static std::unordered_map<std::string, storage_version_t> getStorageVersionInfo() { | ||
return {{"0.0.3", 1}}; | ||
} | ||
|
||
static storage_version_t getStorageVersion() { | ||
auto storageVersionInfo = getStorageVersionInfo(); | ||
if (!storageVersionInfo.contains(KUZU_STORAGE_VERSION)) { | ||
throw common::RuntimeException(common::StringUtils::string_format( | ||
"Invalid storage version name: {}", KUZU_STORAGE_VERSION)); | ||
} | ||
return storageVersionInfo.at(KUZU_STORAGE_VERSION); | ||
} | ||
|
||
static constexpr const char* MAGIC_BYTES = "KUZU"; | ||
}; | ||
|
||
} // namespace storage | ||
} // namespace kuzu |