aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/core/driver_lib/run/version.h
blob: 3c8d82f7fa2074c25fb0c866fd8ae6c074207dae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <library/cpp/actors/interconnect/interconnect_common.h>
#include <ydb/core/protos/config.pb.h>

class TCompatibilityInfo {
    friend class TCompatibilityInfoTest;

public:
    TCompatibilityInfo() = delete;
    static const NKikimrConfig::TCurrentCompatibilityInfo* GetCurrent();
    static const NKikimrConfig::TStoredCompatibilityInfo* GetUnknown();

    static NKikimrConfig::TStoredCompatibilityInfo MakeStored(NKikimrConfig::TCompatibilityRule::EComponentId componentId);

    static bool CheckCompatibility(const NKikimrConfig::TStoredCompatibilityInfo* stored,
            ui32 componentId, TString& errorReason);

    static bool CheckCompatibility(const NKikimrConfig::TCurrentCompatibilityInfo* current,
            const NKikimrConfig::TStoredCompatibilityInfo* stored,
            ui32 componentId, TString& errorReason);

    static NKikimrConfig::TStoredCompatibilityInfo MakeStored(ui32 componentId,
            const NKikimrConfig::TCurrentCompatibilityInfo* current);

private:
    static TSpinLock LockCurrent;
    static NKikimrConfig::TCurrentCompatibilityInfo* CompatibilityInfo;
    static NKikimrConfig::TStoredCompatibilityInfo* UnknownYdbRelease;

    // functions that modify compatibility information are only accessible from friend classes
    static void Reset(NKikimrConfig::TCurrentCompatibilityInfo* newCurrent);
};

// obsolete version control
// TODO: remove in the next major release
extern TMaybe<NActors::TInterconnectProxyCommon::TVersionInfo> VERSION;

void CheckVersionTag();
TString GetBranchName(TString url);