1 /*
2  * Copyright (c) 2023 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 SECURITY_GUARD_I_DB_OPERATE_H
17 #define SECURITY_GUARD_I_DB_OPERATE_H
18 
19 #include "config_define.h"
20 
21 namespace OHOS::Security::SecurityGuard {
22 
23 class IDbOperate {
24 public:
25     virtual ~IDbOperate() = default;
26     virtual int InsertEvent(SecEvent& event) = 0;
27     virtual int QueryAllEvent(std::vector<SecEvent> &events) = 0;
28     virtual int QueryRecentEventByEventId(int64_t eventId, SecEvent &event) = 0;
29     virtual int QueryRecentEventByEventId(const std::vector<int64_t> &eventId,
30         std::vector<SecEvent> &event) = 0;
31     virtual int QueryEventByEventId(int64_t eventId, std::vector<SecEvent> &events) = 0;
32     virtual int QueryEventByEventId(std::vector<int64_t> &eventIds, std::vector<SecEvent> &events) = 0;
33     virtual int QueryEventByEventType(int32_t eventType, std::vector<SecEvent> &events) = 0;
34     virtual int QueryEventByLevel(int32_t level, std::vector<SecEvent> &events) = 0;
35     virtual int QueryEventByOwner(std::string owner, std::vector<SecEvent> &events) = 0;
36     virtual int64_t CountAllEvent() = 0;
37     virtual int64_t CountEventByEventId(int64_t eventId) = 0;
38     virtual int DeleteOldEventByEventId(int64_t eventId, int64_t count) = 0;
39     virtual int DeleteAllEventByEventId(int64_t eventId) = 0;
40 };
41 } // namespace OHOS::Security::SecurityGuard
42 
43 #endif // SECURITY_GUARD_I_DB_OPERATE_H