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 SQLITE_LOCAL_KV_DB_SNAP_SHOT_H 17 #define SQLITE_LOCAL_KV_DB_SNAP_SHOT_H 18 19 #ifndef OMIT_MULTI_VER 20 #include <string> 21 22 #include "macro_utils.h" 23 #include "db_errno.h" 24 #include "db_types.h" 25 #include "ikvdb_snapshot.h" 26 #include "sqlite_local_kvdb_connection.h" 27 28 namespace DistributedDB { 29 class SQLiteLocalKvDBSnapshot : public IKvDBSnapshot { 30 public: 31 explicit SQLiteLocalKvDBSnapshot(IKvDBConnection *connect); 32 ~SQLiteLocalKvDBSnapshot(); 33 34 // Delete the copy and assign constructors 35 DISABLE_COPY_ASSIGN_MOVE(SQLiteLocalKvDBSnapshot); 36 37 // Get the value of the key 38 int Get(const Key &key, Value &value) const override; 39 40 // Get the entries of the key set 41 int GetEntries(const Key &keyPrefix, std::vector<Entry> &entries) const override; 42 43 void Close(); 44 45 private: 46 IKvDBConnection *connect_; 47 }; 48 } // namespace DistributedDB 49 #endif // OMIT_MULTI_VER 50 #endif // SQLITE_LOCAL_KV_DB_SNAP_SHOT_H 51