1 /*
2  * Copyright (c) 2023-2024 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 OHOS_DP_IKV_ADAPTER_H
17 #define OHOS_DP_IKV_ADAPTER_H
18 
19 #include <string>
20 #include <map>
21 #include <vector>
22 #include "distributed_device_profile_enums.h"
23 
24 namespace OHOS {
25 namespace DistributedDeviceProfile {
26 class IKVAdapter {
27 public:
28     IKVAdapter() = default;
29     virtual ~IKVAdapter() = default;
30     virtual int32_t Init() = 0;
31     virtual int32_t UnInit() = 0;
32     virtual int32_t Put(const std::string& key, const std::string& value) = 0;
33     virtual int32_t PutBatch(const std::map<std::string, std::string>& values) = 0;
34     virtual int32_t Delete(const std::string& key) = 0;
35     virtual int32_t DeleteByPrefix(const std::string& keyPrefix) = 0;
36     virtual int32_t Get(const std::string& key, std::string& value) = 0;
37     virtual int32_t GetByPrefix(const std::string& keyPrefix, std::map<std::string, std::string>& values) = 0;
38     virtual int32_t Sync(const std::vector<std::string>& deviceList, SyncMode syncMode) = 0;
39     virtual int32_t GetDeviceEntries(const std::string& udid, std::map<std::string, std::string>& values) = 0;
40     virtual int32_t DeleteBatch(const std::vector<std::string>& keys) = 0;
41 };
42 } // namespace DeviceProfile
43 } // namespace OHOS
44 #endif // OHOS_DP_IKV_ADAPTER_H
45