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 HIVIEW_BASE_EVENT_STORE_CONFIG_EVENT_STORE_CONFIG_H 17 #define HIVIEW_BASE_EVENT_STORE_CONFIG_EVENT_STORE_CONFIG_H 18 19 #include <cstdint> 20 #include <unordered_map> 21 22 #include "singleton.h" 23 24 namespace OHOS { 25 namespace HiviewDFX { 26 namespace EventStore { 27 class EventStoreConfig : public OHOS::DelayedRefSingleton<EventStoreConfig> { 28 public: 29 EventStoreConfig(); ~EventStoreConfig()30 ~EventStoreConfig() {} 31 uint32_t GetStoreDay(int eventType); 32 uint32_t GetMaxSize(int eventType); 33 uint32_t GetMaxFileNum(int eventType); 34 uint32_t GetPageSize(int eventType); 35 uint32_t GetMaxFileSize(int eventType); 36 37 private: 38 struct StoreConfig { 39 uint32_t storeDay; 40 uint32_t pageSize; 41 uint32_t maxFileSize; 42 uint32_t maxFileNum; 43 uint32_t maxSize; 44 }; 45 void Init(); 46 bool Contain(int eventType); 47 48 std::unordered_map<int, StoreConfig> configMap_; 49 }; 50 } // EventStore 51 } // HiviewDFX 52 } // OHOS 53 #endif // HIVIEW_BASE_EVENT_STORE_CONFIG_EVENT_STORE_CONFIG_H 54