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 SINGLE_VER_NATURAL_STORE_H 17 #define SINGLE_VER_NATURAL_STORE_H 18 #include "single_ver_kvdb_sync_interface.h" 19 #include "single_ver_natural_store_commit_notify_data.h" 20 #include "sync_able_kvdb.h" 21 22 namespace DistributedDB { 23 class SingleVerNaturalStore : public SyncAbleKvDB, public SingleVerKvDBSyncInterface { 24 public: 25 SingleVerNaturalStore(); 26 ~SingleVerNaturalStore() override; 27 28 virtual void EnableHandle(); 29 30 virtual void AbortHandle(); 31 32 int RemoveKvDB(const KvDBProperties &properties) override; 33 protected: 34 struct TransPair { 35 int index; 36 RegisterFuncType funcType; 37 }; 38 static RegisterFuncType GetFuncType(int index, const TransPair *transMap, int32_t len); 39 40 void CommitAndReleaseNotifyData(SingleVerNaturalStoreCommitNotifyData *&committedData, 41 bool isNeedCommit, int eventType); 42 }; 43 } // namespace DistributedDB 44 45 #endif // SINGLE_VER_NATURAL_STORE_H