• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 KV_STORE_SNAPSHOT_CALLBACK_H
16 #define KV_STORE_SNAPSHOT_CALLBACK_H
17 
18 #include "store_types.h"
19 #include "types_export.h"
20 
21 class KvStoreSnapshotCallback {
22 public:
KvStoreSnapshotCallback()23     KvStoreSnapshotCallback() {}
~KvStoreSnapshotCallback()24     ~KvStoreSnapshotCallback() {}
25     /**
26      * @tc.steps: step1. Delete the copy and assign constructors.
27      * @tc.expected: step1. operate successfully.
28      */
29     KvStoreSnapshotCallback(const KvStoreSnapshotCallback &callback) = delete;
30     KvStoreSnapshotCallback& operator=(const KvStoreSnapshotCallback &callback) = delete;
31     KvStoreSnapshotCallback(KvStoreSnapshotCallback &&callback) = delete;
32     KvStoreSnapshotCallback& operator=(KvStoreSnapshotCallback &&callback) = delete;
33 
34     void Callback(DistributedDB::DBStatus status, const std::vector<DistributedDB::Entry> &entriesVec);
35     DistributedDB::DBStatus GetStatus();
36     std::vector<DistributedDB::Entry> GetEntries();
37 
38 private:
39     DistributedDB::DBStatus status_ = DistributedDB::DBStatus::INVALID_ARGS;
40     std::vector<DistributedDB::Entry> entriesVec_ = {};
41 };
42 #endif // KV_STORE_SNAPSHOT_CALLBACK_H