Skip to content

Commit

Permalink
Move construction of current compatibility information out of driver_…
Browse files Browse the repository at this point in the history
…lib (#2480)
  • Loading branch information
serbel324 committed Mar 11, 2024
1 parent f24b02a commit f111064
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 32 deletions.
38 changes: 38 additions & 0 deletions ydb/apps/version/version_definition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <ydb/core/driver_lib/version/version.h>

NKikimrConfig::TCurrentCompatibilityInfo NKikimr::TCompatibilityInfo::MakeCurrent() {
using TCurrentConstructor = NKikimr::TCompatibilityInfo::TProtoConstructor::TCurrentCompatibilityInfo;
// using TVersionConstructor = NKikimr::TCompatibilityInfo::TProtoConstructor::TVersion;
// using TCompatibilityRuleConstructor = NKikimr::TCompatibilityInfo::TProtoConstructor::TCompatibilityRule;

return TCurrentConstructor{
.Application = "ydb",
.Version = TVersionConstructor{
.Year = 24,
.Major = 1,
},
.CanLoadFrom = {
TCompatibilityRuleConstructor{
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 4 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
},
.StoresReadableBy = {
TCompatibilityRuleConstructor{
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 4 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
},
.CanConnectTo = {
TCompatibilityRuleConstructor{
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 4 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
TCompatibilityRuleConstructor{
.Application = "nbs",
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 3 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
}
}.ToPB();
}
11 changes: 11 additions & 0 deletions ydb/apps/version/ya.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
LIBRARY(version_definition)

SRCS(
version_definition.cpp
)

PEERDIR(
ydb/core/driver_lib/version
)

END()
1 change: 1 addition & 0 deletions ydb/apps/ydbd/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ IF (ARCH_X86_64)
ENDIF()

PEERDIR(
ydb/apps/version
ydb/core/driver_lib/run
ydb/core/protos
ydb/core/security
Expand Down
1 change: 1 addition & 0 deletions ydb/core/actorlib_impl/ut/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ELSE()
ENDIF()

PEERDIR(
ydb/apps/version
ydb/library/actors/core
ydb/library/actors/interconnect
library/cpp/getopt
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/incrhuge/ut/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ELSE()
ENDIF()

PEERDIR(
ydb/apps/version
ydb/library/actors/protos
ydb/core/blobstorage
ydb/core/blobstorage/incrhuge
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/ut_blobstorage/lib/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SRCS(
PEERDIR(
library/cpp/digest/md5
library/cpp/testing/unittest
ydb/apps/version
ydb/core/base
ydb/core/blob_depot
ydb/core/blobstorage/backpressure
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/ut_group/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ELSE()
ENDIF()

PEERDIR(
ydb/apps/version
ydb/library/actors/interconnect/mock
library/cpp/testing/unittest
ydb/core/blobstorage/crypto
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/ut_mirror3of4/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SIZE(MEDIUM)
TIMEOUT(600)

PEERDIR(
ydb/apps/version
ydb/library/actors/interconnect/mock
library/cpp/testing/unittest
ydb/core/blobstorage/backpressure
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/ut_vdisk/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SRCS(
)

PEERDIR(
ydb/apps/version
ydb/library/actors/protos
library/cpp/codecs
ydb/core/base
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/ut_vdisk2/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SRCS(
)

PEERDIR(
ydb/apps/version
library/cpp/testing/unittest
ydb/core/blobstorage/backpressure
ydb/core/blobstorage/groupinfo
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/vdisk/syncer/ya.make
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
LIBRARY()

PEERDIR(
ydb/apps/version
ydb/library/actors/core
ydb/library/actors/interconnect
library/cpp/monlib/service/pages
Expand Down
1 change: 1 addition & 0 deletions ydb/core/driver_lib/version/ut/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SIZE(MEDIUM)

PEERDIR(
ydb/core/driver_lib/version
ydb/apps/version
)

END()
33 changes: 1 addition & 32 deletions ydb/core/driver_lib/version/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,14 @@ using EComponentId = NKikimrConfig::TCompatibilityRule;
using TComponentId = NKikimrConfig::TCompatibilityRule::EComponentId;

TCompatibilityInfo::TCompatibilityInfo() {
using TCurrentConstructor = TCompatibilityInfo::TProtoConstructor::TCurrentCompatibilityInfo;
using TStoredConstructor = TCompatibilityInfo::TProtoConstructor::TStoredCompatibilityInfo;
using TCompatibilityRuleConstructor = TCompatibilityInfo::TProtoConstructor::TCompatibilityRule;
using TVersionConstructor = TCompatibilityInfo::TProtoConstructor::TVersion;

/////////////////////////////////////////////////////////
// Current CompatibilityInfo
/////////////////////////////////////////////////////////

auto current = TCurrentConstructor{
.Application = "ydb",
.Version = TVersionConstructor{
.Year = 24,
.Major = 1,
},
.CanLoadFrom = {
TCompatibilityRuleConstructor{
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 4 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
},
.StoresReadableBy = {
TCompatibilityRuleConstructor{
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 4 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
},
.CanConnectTo = {
TCompatibilityRuleConstructor{
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 4 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
TCompatibilityRuleConstructor{
.Application = "nbs",
.LowerLimit = TVersionConstructor{ .Year = 23, .Major = 3 },
.UpperLimit = TVersionConstructor{ .Year = 24, .Major = 1 },
},
}
}.ToPB();
auto current = MakeCurrent();

bool success = CompleteFromTag(current);
Y_UNUSED(success);
Expand Down
2 changes: 2 additions & 0 deletions ydb/core/driver_lib/version/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class TCompatibilityInfo {

bool CompleteFromTag(NKikimrConfig::TCurrentCompatibilityInfo& current);

static NKikimrConfig::TCurrentCompatibilityInfo MakeCurrent();

NKikimrConfig::TStoredCompatibilityInfo MakeStored(TComponentId componentId) const;
NKikimrConfig::TStoredCompatibilityInfo MakeStored(TComponentId componentId,
const NKikimrConfig::TCurrentCompatibilityInfo* current) const;
Expand Down
1 change: 1 addition & 0 deletions ydb/core/mind/bscontroller/ut_selfheal/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SRCS(
)

PEERDIR(
ydb/apps/version
ydb/core/blobstorage/dsproxy/mock
ydb/core/blobstorage/pdisk/mock
ydb/core/mind/bscontroller
Expand Down
1 change: 1 addition & 0 deletions ydb/core/testlib/actors/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SRCS(
)

PEERDIR(
ydb/apps/version
ydb/library/actors/testlib
library/cpp/testing/unittest
ydb/core/base
Expand Down
1 change: 1 addition & 0 deletions ydb/core/testlib/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SRCS(
)

PEERDIR(
ydb/apps/version
ydb/library/actors/core
ydb/library/actors/interconnect
ydb/library/grpc/client
Expand Down

0 comments on commit f111064

Please sign in to comment.