1 /* 2 * Copyright (c) 2023 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 CLOUD_SYNC_UTILS_H 16 #define CLOUD_SYNC_UTILS_H 17 18 #include <cstdint> 19 #include "cloud/cloud_store_types.h" 20 #include "icloud_sync_storage_interface.h" 21 22 namespace DistributedDB { 23 int GetCloudPkVals(const VBucket &datum, const std::vector<std::string> &pkColNames, int64_t dataKey, 24 std::vector<Type> &cloudPkVals); 25 26 ChangeType OpTypeToChangeType(OpType strategy); 27 28 bool IsSinglePrimaryKey(const std::vector<std::string> &pKColNames); 29 30 void RemoveDataExceptExtendInfo(VBucket &datum, const std::vector<std::string> &pkColNames); 31 32 AssetOpType StatusToFlag(AssetStatus status); 33 34 void StatusToFlagForAsset(Asset &asset); 35 36 void StatusToFlagForAssets(Assets &assets); 37 38 void StatusToFlagForAssetsInRecord(const std::vector<Field> &fields, VBucket &record); 39 40 bool IsChngDataEmpty(const ChangedData &changedData); 41 42 bool EqualInMsLevel(const Timestamp cmp, const Timestamp beCmp); 43 44 bool NeedSaveData(const LogInfo &localLogInfo, const LogInfo &cloudLogInfo); 45 } 46 #endif // CLOUD_SYNC_UTILS_H