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 #ifndef SYNC_CONFIG_H 16 #define SYNC_CONFIG_H 17 18 #include <cstdint> 19 #include <set> 20 #include <map> 21 #include "macro_utils.h" 22 #include "parcel.h" 23 #include "types_export.h" 24 25 // db ability config 26 namespace DistributedDB { 27 // offset, used_bits_num, used_bits_num < 8 28 using AbilityItem = std::pair<uint32_t, uint32_t>; 29 // format: {offset, used_bits_num} 30 /* 31 if need to add new ability, just add append to the last ability 32 current ability format: 33 |first bit|second bit|third bit| 34 |DATABASE_COMPRESSION_ZLIB|ALLPREDICATEQUERY|SUBSCRIBEQUERY| 35 */ 36 class SyncConfig final { 37 public: 38 static const AbilityItem DATABASE_COMPRESSION_ZLIB; 39 static const AbilityItem ALLPREDICATEQUERY; 40 static const AbilityItem SUBSCRIBEQUERY; 41 static const AbilityItem INKEYS_QUERY; 42 static const std::vector<AbilityItem> ABILITYBITS; 43 static const std::map<const uint8_t, const AbilityItem> COMPRESSALGOMAP; 44 }; 45 } 46 #endif