1 /*
2  * Copyright (c) 2021-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 HIVIEW_BASE_EVENT_STORE_INCLUDE_SYS_EVENT_DAO_H
17 #define HIVIEW_BASE_EVENT_STORE_INCLUDE_SYS_EVENT_DAO_H
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "sys_event.h"
24 #include "sys_event_query.h"
25 
26 namespace OHOS {
27 namespace HiviewDFX {
28 namespace EventStore {
29 class SysEventDao {
30 public:
31     /* for internal query */
32     static std::shared_ptr<SysEventQuery> BuildQuery(const std::string& domain, const std::vector<std::string>& names);
33 
34     /* for external query */
35     static std::shared_ptr<SysEventQuery> BuildQuery(const std::string& domain,
36         const std::vector<std::string>& names, uint32_t type, int64_t toSeq, int64_t fromSeq);
37 
38     static int Insert(std::shared_ptr<SysEvent> sysEvent);
39     static void CheckRepeat(SysEvent& event);
40     static void Backup();
41     static void Restore();
42     static std::string GetDatabaseDir();
43     static void Clear();
44 }; // SysEventDao
45 } // EventStore
46 } // namespace HiviewDFX
47 } // namespace OHOS
48 #endif // HIVIEW_BASE_EVENT_STORE_INCLUDE_SYS_EVENT_DAO_H
49