Make version enum private

This commit is contained in:
Robert Schulze 2023-01-20 10:47:42 +00:00
parent 0653f86de9
commit be936b257c
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
2 changed files with 9 additions and 8 deletions

View File

@ -225,7 +225,7 @@ UInt32 GinIndexStore::getNumOfSegments()
uint8_t version = 0;
readBinary(version, *istr);
if (version > CURRENT_GIN_FILE_FORMAT_VERSION)
if (version > static_cast<std::underlying_type_t<Format>>(CURRENT_GIN_FILE_FORMAT_VERSION))
throw Exception(ErrorCodes::UNKNOWN_FORMAT_VERSION, "Unsupported inverted index version {}", version);
readVarUInt(result, *istr);

View File

@ -34,13 +34,6 @@
namespace DB
{
enum : uint8_t
{
GIN_VERSION_0 = 0,
GIN_VERSION_1 = 1, /// Initial version
};
static constexpr auto CURRENT_GIN_FILE_FORMAT_VERSION = GIN_VERSION_1;
/// GinIndexPostingsList which uses 32-bit Roaring
using GinIndexPostingsList = roaring::Roaring;
@ -217,6 +210,14 @@ private:
static constexpr auto GIN_SEGMENT_FILE_TYPE = ".gin_seg";
static constexpr auto GIN_DICTIONARY_FILE_TYPE = ".gin_dict";
static constexpr auto GIN_POSTINGS_FILE_TYPE = ".gin_post";
enum class Format : uint8_t
{
v0 = 0,
v1 = 1, /// Initial version
};
static constexpr auto CURRENT_GIN_FILE_FORMAT_VERSION = Format::v0;
};
using GinIndexStorePtr = std::shared_ptr<GinIndexStore>;