/[LeafOK_CVS]/lbbs/include/article_view_log.h
ViewVC logotype

Annotation of /lbbs/include/article_view_log.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Wed Nov 5 01:50:32 2025 UTC (4 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.6: +4 -1 lines
Content type: text/x-chdr
Use enum instead of macro define constant integers

1 sysadm 1.5 /* SPDX-License-Identifier: GPL-3.0-or-later */
2     /*
3     * article_view_log
4     * - data persistence and query of article view log
5     *
6 sysadm 1.6 * Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com>
7 sysadm 1.5 */
8 sysadm 1.1
9     #ifndef _ARTICLE_VIEW_LOG_H_
10     #define _ARTICLE_VIEW_LOG_H_
11    
12     #include <stdint.h>
13    
14 sysadm 1.7 enum article_view_log_constant_t
15     {
16     MAX_VIEWED_AID_INC_CNT = 1000,
17     };
18 sysadm 1.1
19     struct article_view_log_t
20     {
21 sysadm 1.3 int uid;
22 sysadm 1.1 int32_t *aid_base;
23     int aid_base_cnt;
24 sysadm 1.4 int32_t aid_inc[MAX_VIEWED_AID_INC_CNT];
25 sysadm 1.1 int aid_inc_cnt;
26     };
27     typedef struct article_view_log_t ARTICLE_VIEW_LOG;
28    
29 sysadm 1.3 extern ARTICLE_VIEW_LOG BBS_article_view_log;
30    
31 sysadm 1.1 // Load baseline view log from DB
32     extern int article_view_log_load(int uid, ARTICLE_VIEW_LOG *p_view_log, int keep_inc);
33     // Clear data
34 sysadm 1.2 extern int article_view_log_unload(ARTICLE_VIEW_LOG *p_view_log);
35 sysadm 1.1 // Save incremental view log to DB
36 sysadm 1.3 extern int article_view_log_save_inc(const ARTICLE_VIEW_LOG *p_view_log);
37 sysadm 1.1 // Merge incremental view log to baseline, without DB read / write
38     extern int article_view_log_merge_inc(ARTICLE_VIEW_LOG *p_view_log);
39    
40     // Check if specific article was viewed
41     extern int article_view_log_is_viewed(int32_t aid, const ARTICLE_VIEW_LOG *p_view_log);
42     // Set specific article as viewed
43     extern int article_view_log_set_viewed(int32_t aid, ARTICLE_VIEW_LOG *p_view_log);
44    
45     #endif //_ARTICLE_VIEW_LOG_H_

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1