1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef VERSION_H 17 #define VERSION_H 18 19 #include <string> 20 #include <cstdint> 21 22 namespace DistributedDB { 23 // Version Regulation: 24 // Module version is always equal to the max version of its submodule. 25 // If a module or submodule upgrade to higher version, DO NOT simply increase current version by 1. 26 // First: you have to preserve current version by renaming it as a historical version. 27 // Second: Update the current version to the version to be release. 28 // Finally: Update its parent module's version if exist. 29 // Why we update the current version to the version to be release? For example, if module A has submodule B and C, 30 // if now version of B is 105, and C is 101, thus version of A is 105; if now release version is 106 and we upgrade 31 // submodule C, if we simply change version of C to 102 then version of A is still 105, but if we change version of C 32 // to 106 then version of A is now 106, so we can know that something had changed for module A. 33 constexpr const char *SOFTWARE_VERSION_STRING = "1.1.5"; // DistributedDB current version string. 34 constexpr const uint32_t SOFTWARE_VERSION_BASE = 100; // Software version base value, do not change it 35 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_1_0 = SOFTWARE_VERSION_BASE + 1; // 1 for first released version 36 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_2_0 = SOFTWARE_VERSION_BASE + 2; // 2 for second released version 37 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_3_0 = SOFTWARE_VERSION_BASE + 3; // 3 for third released version 38 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_4_0 = SOFTWARE_VERSION_BASE + 4; // 4 for fourth released version 39 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_5_0 = SOFTWARE_VERSION_BASE + 5; // 5 for fifth released version 40 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_6_0 = SOFTWARE_VERSION_BASE + 6; // 6 for sixth released version 41 // check both device has security label at 107 42 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_7_0 = SOFTWARE_VERSION_BASE + 7; // 7 for seventh released version 43 // kv ability sync with 2 packet at 108 44 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_8_0 = SOFTWARE_VERSION_BASE + 8; // 8 for eighth released version 45 // 109 version add field in request packet 46 // add schema version in ability request 47 // add schema version, system time offset, sender local time offset in data request 48 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_9_0 = SOFTWARE_VERSION_BASE + 9; // 9 for ninth released version 49 // 110 version add totalDataCount field in DataRequestPkt 50 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_10_0 = SOFTWARE_VERSION_BASE + 10; // 10 for tenth released version 51 // 111 version record remote version and rdb sync with config column 52 constexpr const uint32_t SOFTWARE_VERSION_RELEASE_11_0 = SOFTWARE_VERSION_BASE + 11; // 11 for tenth released version 53 constexpr const uint32_t SOFTWARE_VERSION_EARLIEST = SOFTWARE_VERSION_RELEASE_1_0; 54 constexpr const uint32_t SOFTWARE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_11_0; 55 constexpr const int VERSION_INVALID = INT32_MAX; 56 57 // Storage Related Version 58 // LocalNaturalStore Related Version 59 constexpr const int LOCAL_STORE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_1_0; 60 // SingleVerNaturalStore Related Version 61 constexpr const int SINGLE_VER_STORE_VERSION_V1 = SOFTWARE_VERSION_RELEASE_1_0; 62 constexpr const int SINGLE_VER_STORE_VERSION_V2 = SOFTWARE_VERSION_RELEASE_2_0; 63 constexpr const int SINGLE_VER_STORE_VERSION_V3 = SOFTWARE_VERSION_RELEASE_3_0; 64 // 104 add modify time and create time into sync_data 65 constexpr const int SINGLE_VER_STORE_VERSION_V4 = SOFTWARE_VERSION_RELEASE_4_0; 66 constexpr const int SINGLE_VER_STORE_VERSION_CURRENT = SINGLE_VER_STORE_VERSION_V4; 67 // MultiVerNaturalStore Related Version 68 constexpr const uint32_t VERSION_FILE_VERSION_CURRENT = 1; 69 constexpr const uint32_t MULTI_VER_STORE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_1_0; 70 constexpr const int MULTI_VER_COMMIT_STORAGE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_1_0; 71 constexpr const int MULTI_VER_DATA_STORAGE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_1_0; 72 constexpr const int MULTI_VER_METADATA_STORAGE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_1_0; 73 constexpr const int MULTI_VER_VALUESLICE_STORAGE_VERSION_CURRENT = SOFTWARE_VERSION_RELEASE_1_0; 74 75 // Syncer Related Version 76 constexpr const int TIME_SYNC_VERSION_V1 = SOFTWARE_VERSION_RELEASE_1_0; // time sync proctol added in version 101. 77 // Ability sync proctol added in version 102. 78 constexpr const int ABILITY_SYNC_VERSION_V1 = SOFTWARE_VERSION_RELEASE_2_0; 79 constexpr const uint32_t SINGLE_VER_SYNC_PROCTOL_V1 = SOFTWARE_VERSION_RELEASE_1_0; // The 1st version num 80 constexpr const uint32_t SINGLE_VER_SYNC_PROCTOL_V2 = SOFTWARE_VERSION_RELEASE_2_0; // The 2nd version num 81 constexpr const uint32_t SINGLE_VER_SYNC_PROCTOL_V3 = SOFTWARE_VERSION_RELEASE_3_0; // The third version num 82 83 // Local Meta Data Version 84 constexpr const uint32_t LOCAL_META_DATA_VERSION_V1 = SOFTWARE_VERSION_RELEASE_8_0; 85 constexpr const uint32_t LOCAL_META_DATA_VERSION_V2 = SOFTWARE_VERSION_RELEASE_9_0; 86 } // namespace DistributedDB 87 88 #endif // VERSION_H