--- lbbs/include/article_view_log.h 2025/06/07 08:07:07 1.2 +++ lbbs/include/article_view_log.h 2025/11/05 01:50:32 1.7 @@ -1,41 +1,39 @@ -/*************************************************************************** - article_view_log.h - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * article_view_log + * - data persistence and query of article view log + * + * Copyright (C) 2004-2025 Leaflet + */ #ifndef _ARTICLE_VIEW_LOG_H_ #define _ARTICLE_VIEW_LOG_H_ #include -#define MAX_AID_INC_CNT 100000 +enum article_view_log_constant_t +{ + MAX_VIEWED_AID_INC_CNT = 1000, +}; struct article_view_log_t { + int uid; int32_t *aid_base; int aid_base_cnt; - int32_t aid_inc[MAX_AID_INC_CNT]; + int32_t aid_inc[MAX_VIEWED_AID_INC_CNT]; int aid_inc_cnt; }; typedef struct article_view_log_t ARTICLE_VIEW_LOG; +extern ARTICLE_VIEW_LOG BBS_article_view_log; + // Load baseline view log from DB extern int article_view_log_load(int uid, ARTICLE_VIEW_LOG *p_view_log, int keep_inc); // Clear data extern int article_view_log_unload(ARTICLE_VIEW_LOG *p_view_log); // Save incremental view log to DB -extern int article_view_log_save_inc(int uid, const ARTICLE_VIEW_LOG *p_view_log); +extern int article_view_log_save_inc(const ARTICLE_VIEW_LOG *p_view_log); // Merge incremental view log to baseline, without DB read / write extern int article_view_log_merge_inc(ARTICLE_VIEW_LOG *p_view_log);