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 16 #ifndef MULTI_STORAGE_ENGINE_H 17 #define MULTI_STORAGE_ENGINE_H 18 19 #ifndef OMIT_MULTI_VER 20 #include "storage_engine.h" 21 #include "macro_utils.h" 22 #include "ikvdb.h" 23 #include "ikvdb_multi_ver_data_storage.h" 24 #include "ikvdb_commit_storage.h" 25 #include "multi_ver_kvdata_storage.h" 26 27 namespace DistributedDB { 28 class MultiVerStorageEngine : public StorageEngine { 29 public: 30 MultiVerStorageEngine(); 31 ~MultiVerStorageEngine() override; 32 33 // Delete the copy and assign constructors 34 DISABLE_COPY_ASSIGN_MOVE(MultiVerStorageEngine); 35 36 int InitDatabases(IKvDB *kvDB, IKvDBMultiVerDataStorage *dataStorage, 37 IKvDBCommitStorage *commitStorage, MultiVerKvDataStorage *kvDataStorage, const StorageEngineAttr &poolSize); 38 39 protected: 40 int CreateNewExecutor(bool isWrite, StorageExecutor *&handle) override; 41 42 private: 43 IKvDB *kvDB_; 44 IKvDBMultiVerDataStorage *dataStorage_; 45 IKvDBCommitStorage *commitStorage_; 46 MultiVerKvDataStorage *kvDataStorage_; 47 }; 48 } // namespace DistributedDB 49 #endif // MULTI_STORAGE_ENGINE_H 50 #endif