Skip to content

Commit 56bd304

Browse files
authored
add maximum version (#1153)
Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
1 parent 33c9df9 commit 56bd304

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

include/knowhere/version.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace {
2222
static constexpr int32_t default_version = 0;
2323
static constexpr int32_t minimal_version = 0;
2424
static constexpr int32_t current_version = 6;
25+
static constexpr int32_t maximum_version = 7;
2526
} // namespace
2627

2728
class Version {
@@ -35,12 +36,18 @@ class Version {
3536
return Version(default_version);
3637
}
3738

38-
// the current version (newest version support)
39+
// the recommended version
3940
static inline Version
4041
GetCurrentVersion() {
4142
return Version(current_version);
4243
}
4344

45+
// the maximum version (beta version)
46+
static inline Version
47+
GetMaximumVersion() {
48+
return Version(maximum_version);
49+
}
50+
4451
// the minimal version (oldest version support)
4552
static inline Version
4653
GetMinimalVersion() {
@@ -49,12 +56,12 @@ class Version {
4956

5057
static inline bool
5158
VersionSupport(const Version& version) {
52-
return GetMinimalVersion() <= version && version <= GetCurrentVersion();
59+
return GetMinimalVersion() <= version && version <= GetMaximumVersion();
5360
}
5461

5562
static inline std::pair<Version, Version>
5663
GetSupportRange() {
57-
return std::make_pair(Version(minimal_version), Version(current_version));
64+
return std::make_pair(Version(minimal_version), Version(maximum_version));
5865
}
5966

6067
// the version number

tests/ut/test_utils.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ TEST_CASE("Test Version") {
149149
REQUIRE(knowhere::Version::VersionSupport(knowhere::Version::GetDefaultVersion()));
150150
REQUIRE(knowhere::Version::VersionSupport(knowhere::Version::GetMinimalVersion()));
151151
REQUIRE(knowhere::Version::VersionSupport(knowhere::Version::GetCurrentVersion()));
152+
REQUIRE(knowhere::Version::VersionSupport(knowhere::Version::GetMaximumVersion()));
153+
REQUIRE(knowhere::Version::GetMinimalVersion() <= knowhere::Version::GetCurrentVersion());
154+
REQUIRE(knowhere::Version::GetCurrentVersion() <= knowhere::Version::GetMaximumVersion());
152155
}
153156

154157
TEST_CASE("Test DiskLoad") {

0 commit comments

Comments
 (0)