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 16 #ifndef CLOUD_SYNC_STRATEGY_H 17 #define CLOUD_SYNC_STRATEGY_H 18 19 #include "data_transformer.h" 20 #include "db_errno.h" 21 #include "db_types.h" 22 #include "icloud_sync_storage_interface.h" 23 24 namespace DistributedDB { 25 class CloudSyncStrategy { 26 public: 27 CloudSyncStrategy() = default; 28 virtual ~CloudSyncStrategy() = default; 29 TagSyncDataStatus(bool existInLocal,LogInfo & localInfo,LogInfo & cloudInfo,std::set<Key> & deletePrimaryKeySet)30 virtual OpType TagSyncDataStatus(bool existInLocal, LogInfo &localInfo, LogInfo &cloudInfo, 31 std::set<Key> &deletePrimaryKeySet) 32 { 33 (void)existInLocal; 34 (void)localInfo; 35 (void)cloudInfo; 36 (void)deletePrimaryKeySet; 37 return OpType::NOT_HANDLE; 38 } 39 JudgeUpdateCursor()40 virtual bool JudgeUpdateCursor() 41 { 42 return false; 43 } 44 JudgeUpload()45 virtual bool JudgeUpload() 46 { 47 return false; 48 } 49 IsDelete(const LogInfo & info)50 static bool IsDelete(const LogInfo &info) 51 { 52 return (info.flag & 0x1) == 1; 53 } 54 }; 55 } 56 #endif // CLOUD_SYNC_STRATEGY_H 57