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_VER_NATURAL_STORE_SNAPSHOT_H 17 #define MULTI_VER_NATURAL_STORE_SNAPSHOT_H 18 19 #ifndef OMIT_MULTI_VER 20 #include "ikvdb_snapshot.h" 21 #include "storage_executor.h" 22 23 namespace DistributedDB { 24 class MultiVerNaturalStoreSnapshot : public IKvDBSnapshot { 25 public: 26 explicit MultiVerNaturalStoreSnapshot(StorageExecutor *handle); 27 ~MultiVerNaturalStoreSnapshot() override; 28 29 DISABLE_COPY_ASSIGN_MOVE(MultiVerNaturalStoreSnapshot); 30 31 // Get the value according the key in the snapshot 32 int Get(const Key &key, Value &value) const override; 33 34 // Get the data according the prefix key in the snapshot 35 int GetEntries(const Key &keyPrefix, std::vector<Entry> &entries) const override; 36 37 void Close(); 38 39 private: 40 StorageExecutor *databaseHandle_; 41 }; 42 } // namespace DistributedDB 43 44 #endif // MULTI_VER_NATURAL_STORE_SNAPSHOT_H 45 #endif