• 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 
16 #ifndef CHANGE_NOTIFICATION_H
17 #define CHANGE_NOTIFICATION_H
18 
19 #include <list>
20 #include "types.h"
21 
22 namespace OHOS {
23 namespace DistributedKv {
24 class ChangeNotification final {
25 public:
26     // Constructor of ChangeNotification.
27     API_EXPORT ChangeNotification(std::vector<Entry> &&insertEntries, std::vector<Entry> &&updateEntries,
28                        std::vector<Entry> &&deleteEntries, const std::string &deviceId, bool isClear);
29 
30     API_EXPORT ~ChangeNotification();
31 
32     // Get all inserted entries in this change.
33     API_EXPORT const std::vector<Entry> &GetInsertEntries() const;
34 
35     // Get all updated entries in this changing.
36     API_EXPORT const std::vector<Entry> &GetUpdateEntries() const;
37 
38     // Get all deleted entries in this changing.
39     API_EXPORT const std::vector<Entry> &GetDeleteEntries() const;
40 
41     // Get the device ID.
42     API_EXPORT const std::string &GetDeviceId() const;
43 
44     // Check if this change is made by calling the Clear function.
45     API_EXPORT bool IsClear() const;
46 
47 private:
48     std::vector<Entry> insertEntries_;
49 
50     std::vector<Entry> updateEntries_;
51 
52     std::vector<Entry> deleteEntries_;
53 
54     std::string deviceId_;
55 
56     bool isClear_ = false;
57 };
58 }  // namespace DistributedKv
59 }  // namespace OHOS
60 #endif  // CHANGE_NOTIFICATION_H
61