1 /* 2 * Copyright (C) 2022 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 FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_AGING_HELPER_H_ 17 #define FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_AGING_HELPER_H_ 18 19 #include "medialibrary_async_worker.h" 20 #include "rdb_helper.h" 21 #include "single_kvstore.h" 22 #include "thumbnail_utils.h" 23 24 namespace OHOS { 25 namespace Media { 26 class AgingAsyncTaskData : public AsyncTaskData { 27 public: 28 AgingAsyncTaskData() = default; 29 virtual ~AgingAsyncTaskData() override = default; 30 ThumbRdbOpt opts; 31 ThumbnailData thumbnailData; 32 }; 33 34 class ThumbnailAgingHelper { 35 public: 36 ThumbnailAgingHelper() = delete; 37 virtual ~ThumbnailAgingHelper() = delete; 38 39 EXPORT static int32_t AgingLcdBatch(ThumbRdbOpt &opts); 40 41 EXPORT static int32_t ClearLcdFromFileTable(ThumbRdbOpt &opts); 42 EXPORT static int32_t GetAgingDataCount(const int64_t &time, const bool &before, ThumbRdbOpt &opts, int &count); 43 private: 44 EXPORT static int32_t GetLcdCount(ThumbRdbOpt &opts, int &outLcdCount); 45 EXPORT static int32_t GetAgingLcdData(ThumbRdbOpt &opts, int LcdLimit, std::vector<ThumbnailData> &outDatas); 46 EXPORT static int32_t GetDistributeLcdCount(ThumbRdbOpt &opts, int &outLcdCount); 47 EXPORT static int32_t GetAgingDistributeLcdData(ThumbRdbOpt &opts, 48 int LcdLimit, std::vector<ThumbnailData> &outDatas); 49 EXPORT static int32_t GetLcdCountByTime(const int64_t &time, const bool &before, ThumbRdbOpt &opts, 50 int &outLcdCount); 51 }; 52 } // namespace Media 53 } // namespace OHOS 54 55 #endif // FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_AGING_HELPER_H_ 56