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 DISTRIBUTEDDB_CONSTANT_DEFINE_H 17 #define DISTRIBUTEDDB_CONSTANT_DEFINE_H 18 19 #include <string> 20 #include "store_types.h" 21 22 namespace DistributedDBDataGenerator { 23 const int TEST_ID_1 = 1; 24 const int TEST_ID_2 = 2; 25 const int TEST_ID_3 = 3; 26 const int TEST_ID_4 = 4; 27 const int TEST_ID_5 = 5; 28 const int TEST_ID_6 = 6; 29 const int TEST_ID_7 = 7; 30 const int TEST_ID_8 = 8; 31 const int TEST_ID_9 = 9; 32 const int TEST_ID_10 = 10; 33 const int TEST_ID_11 = 11; 34 const int TEST_ID_12 = 12; 35 const int TEST_ID_13 = 13; 36 const int TEST_ID_14 = 14; 37 const int TEST_ID_15 = 15; 38 const int TEST_ID_16 = 16; 39 const int TEST_ID_17 = 17; 40 const int TEST_ID_18 = 18; 41 const int TEST_ID_19 = 19; 42 const int TEST_ID_20 = 20; 43 const int TEST_ID_21 = 21; 44 const int TEST_ID_22 = 22; 45 const int TEST_ID_23 = 23; 46 const int TEST_ID_24 = 24; 47 const int TEST_ID_25 = 25; 48 const int TEST_ID_26 = 26; 49 const int TEST_ID_27 = 27; 50 const int TEST_ID_28 = 28; 51 const int TEST_ID_29 = 29; 52 const int TEST_ID_30 = 30; 53 const int TEST_ID_31 = 31; 54 const int TEST_ID_32 = 32; 55 const int TEST_ID_33 = 33; 56 const int TEST_ID_34 = 34; 57 const int TEST_ID_35 = 35; 58 const int TEST_ID_36 = 36; 59 const int TEST_ID_37 = 37; 60 const int TEST_ID_38 = 38; 61 const int TEST_ID_39 = 39; 62 const int TEST_ID_40 = 40; 63 const int TEST_ID_41 = 41; 64 const int TEST_ID_42 = 42; 65 const int TEST_ID_43 = 43; 66 const int TEST_ID_44 = 44; 67 const int TEST_ID_45 = 45; 68 const int TEST_ID_46 = 46; 69 const int TEST_ID_47 = 47; 70 const int TEST_ID_48 = 48; 71 const int TEST_ID_49 = 49; 72 const int TEST_ID_50 = 50; 73 const int TEST_ID_51 = 51; 74 const int TEST_ID_52 = 52; 75 76 class DistributedDBConstant { 77 public: 78 static const std::string NB_DIRECTOR; // default work dir. 79 static const std::string NB_DATABASE_NAME; 80 static const std::string NORMAL_COMMON_SCHEMA; 81 static const std::string COMPATIBLE_FOR_NORMAL_COMMON_SCHEMA; 82 static const std::string UNCOMPATIBLE_FOR_NORMAL_COMMON_SCHEMA; 83 // default kvStoreDelegateManager's config. 84 static const DistributedDB::KvStoreConfig CONFIG; 85 static const std::string DB_FILE_DOCUMENT; 86 static constexpr int UNLOCK_ACCESS = 0; 87 static constexpr int LOCKED_ACCESS = 1; 88 static constexpr uint32_t THIRTY_MINUTES = 1800; 89 static constexpr uint32_t WAIT_UNTIL_CALLBACK_COME = 0; 90 91 // ************************ SYNC PACKET ************************************ 92 static constexpr int ZERO_PACKET = 0; 93 static constexpr int ONE_PACKET = 1; 94 static constexpr int TWO_PACKETS = 2; 95 static constexpr int THREE_PACKETS = 3; 96 static constexpr int FOUR_PACKETS = 4; 97 static constexpr int EIGHT_PACKETS = 8; 98 static constexpr int FIRST_PACKET = 1; 99 static constexpr int THIRD_PACKET = 3; 100 static constexpr int FIFTH_PACKET = 5; 101 static constexpr int EIGHTH_PACKET = 8; 102 static constexpr uint32_t THROW_PACKET_CNT_LEN = 168; // the length of data packet is greater than 168 103 // the length of registering subscriber packet is greater than 111 104 static constexpr uint32_t REGISTER_SUBSCRIBER_PACKET_LEN = 111; 105 106 // ************************ MILLISECOND ************************************ 107 static const unsigned int THREE_S_TO_MS = 3000; 108 static const unsigned int FIVE_S_TO_MS = 5000; 109 static const unsigned int EIGHT_S_TO_MS = 8000; 110 static const unsigned int NINE_S_TO_MS = 9000; 111 static const unsigned int TEN_S_TO_MS = 10000; 112 static const unsigned int SIXTY_S_TO_MS = 60000; 113 114 // ************************ compression ratio ************************** 115 static const unsigned int COMPRESSION_RATIO_ZERO = 0; 116 static const unsigned int COMPRESSION_RATIO_TEN = 10; 117 static const unsigned int COMPRESSION_RATIO_TWENTY = 20; 118 static const unsigned int COMPRESSION_RATIO_THIRTY = 30; 119 static const unsigned int COMPRESSION_RATIO_FORTY = 40; 120 static const unsigned int COMPRESSION_RATIO_FIFTY = 50; 121 static const unsigned int COMPRESSION_RATIO_SIXTY = 60; 122 static const unsigned int COMPRESSION_RATIO_SEVENTY = 70; 123 static const unsigned int COMPRESSION_RATIO_EIGHTY = 80; 124 static const unsigned int COMPRESSION_RATIO_NINETY = 90; 125 static const unsigned int COMPRESSION_RATIO_ONE_HUNDRED = 100; 126 static const unsigned int COMPRESSION_RATIO_ONE_HUNDRED_AND_ONE = 101; 127 128 // ************************ record number ************************** 129 static const unsigned int THIRTY_THOUSAND_RECORDS = 30000; 130 }; 131 } // namespace DistributedDBDataGenerator 132 133 #endif // DISTRIBUTEDDB_CONSTANT_DEFINE_H 134