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(RelationalSyncStrategy &strategy, bool isSchemaSync); 35 std::pair<bool, bool> GetSchemaSyncStatus(QuerySyncObject &querySyncObject) const override; 36 37 void SchemaChange() override; 38 protected: 39 ~SingleVerRelationalSyncTaskContext() override; 40 void CopyTargetData(const ISyncTarget *target, const TaskParam &taskParam) override; 41 42 mutable std::mutex querySyncIdMutex_; 43 std::string querySyncId_; 44 45 mutable std::mutex deleteSyncIdMutex_; 46 std::string deleteSyncId_; 47 48 // for relational syncStrategy 49 mutable std::mutex syncStrategyMutex_; 50 RelationalSyncStrategy relationalSyncStrategy_; 51 bool isSchemaSync_ = false; 52 }; 53 } 54 #endif // RELATIONAL_STORE 55 #endif // SINGLE_VER_RELATIONAL_SYNC_TASK_CONTEXT_H