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 I_RELATIONAL_STORE_H 16 #define I_RELATIONAL_STORE_H 17 #ifdef RELATIONAL_STORE 18 19 #include <functional> 20 #include <string> 21 22 #include "ref_object.h" 23 #include "relationaldb_properties.h" 24 #include "relational_store_connection.h" 25 26 namespace DistributedDB { 27 class IRelationalStore : public virtual RefObject { 28 public: 29 IRelationalStore() = default; 30 ~IRelationalStore() override = default; 31 DISABLE_COPY_ASSIGN_MOVE(IRelationalStore); 32 33 // Open the database. 34 virtual int Open(const RelationalDBProperties &properties) = 0; 35 36 virtual void WakeUpSyncer() = 0; 37 38 // Create a db connection. 39 virtual RelationalStoreConnection *GetDBConnection(int &errCode) = 0; 40 41 virtual std::string GetStorePath() const = 0; 42 43 virtual RelationalDBProperties GetProperties() const = 0; 44 45 virtual void Dump(int fd) = 0; 46 }; 47 } // namespace DistributedDB 48 49 #endif 50 #endif // I_RELATIONAL_STORE_H