1 /* 2 * Copyright (c) 2022 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 SINGLE_VER_RELATIONAL_SYNC_TASK_CONTEXT_H 17 #define SINGLE_VER_RELATIONAL_SYNC_TASK_CONTEXT_H 18 19 #ifdef RELATIONAL_STORE 20 #include "single_ver_sync_task_context.h" 21 22 namespace DistributedDB { 23 class SingleVerRelationalSyncTaskContext : public SingleVerSyncTaskContext { 24 public: 25 26 explicit SingleVerRelationalSyncTaskContext(); 27 28 DISABLE_COPY_ASSIGN_MOVE(SingleVerRelationalSyncTaskContext); 29 30 void Clear() override; 31 std::string GetQuerySyncId() const override; 32 std::string GetDeleteSyncId() const override; 33 34 void SetRelationalSyncStrategy(const RelationalSyncStrategy &strategy, bool isSchemaSync); 35 std::pair<bool, bool> GetSchemaSyncStatus(QuerySyncObject &querySyncObject) const override; 36 37 void SchemaChange() override; 38 39 bool IsSchemaCompatible() const override; 40 protected: 41 ~SingleVerRelationalSyncTaskContext() override; 42 void CopyTargetData(const ISyncTarget *target, const TaskParam &taskParam) override; 43 44 mutable std::mutex querySyncIdMutex_; 45 std::string querySyncId_; 46 47 mutable std::mutex deleteSyncIdMutex_; 48 std::string deleteSyncId_; 49 50 // for relational syncStrategy 51 mutable std::mutex syncStrategyMutex_; 52 RelationalSyncStrategy relationalSyncStrategy_; 53 bool isSchemaSync_ = false; 54 }; 55 } 56 #endif // RELATIONAL_STORE 57 #endif // SINGLE_VER_RELATIONAL_SYNC_TASK_CONTEXT_H