| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
article_view_log.h - description |
/* |
| 3 |
------------------- |
* article_view_log |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - data persistence and query of article view log |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* 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. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#ifndef _ARTICLE_VIEW_LOG_H_ |
#ifndef _ARTICLE_VIEW_LOG_H_ |
| 10 |
#define _ARTICLE_VIEW_LOG_H_ |
#define _ARTICLE_VIEW_LOG_H_ |
| 11 |
|
|
| 12 |
#include <stdint.h> |
#include <stdint.h> |
| 13 |
|
|
| 14 |
#define MAX_AID_INC_CNT 100000 |
#define MAX_VIEWED_AID_INC_CNT 1000 |
| 15 |
|
|
| 16 |
struct article_view_log_t |
struct article_view_log_t |
| 17 |
{ |
{ |
| 18 |
|
int uid; |
| 19 |
int32_t *aid_base; |
int32_t *aid_base; |
| 20 |
int aid_base_cnt; |
int aid_base_cnt; |
| 21 |
int32_t aid_inc[MAX_AID_INC_CNT]; |
int32_t aid_inc[MAX_VIEWED_AID_INC_CNT]; |
| 22 |
int aid_inc_cnt; |
int aid_inc_cnt; |
| 23 |
}; |
}; |
| 24 |
typedef struct article_view_log_t ARTICLE_VIEW_LOG; |
typedef struct article_view_log_t ARTICLE_VIEW_LOG; |
| 25 |
|
|
| 26 |
|
extern ARTICLE_VIEW_LOG BBS_article_view_log; |
| 27 |
|
|
| 28 |
// Load baseline view log from DB |
// Load baseline view log from DB |
| 29 |
extern int article_view_log_load(int uid, ARTICLE_VIEW_LOG *p_view_log, int keep_inc); |
extern int article_view_log_load(int uid, ARTICLE_VIEW_LOG *p_view_log, int keep_inc); |
| 30 |
// Clear data |
// Clear data |
| 31 |
extern int article_view_log_unload(ARTICLE_VIEW_LOG *p_view_log); |
extern int article_view_log_unload(ARTICLE_VIEW_LOG *p_view_log); |
| 32 |
// Save incremental view log to DB |
// Save incremental view log to DB |
| 33 |
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); |
| 34 |
// Merge incremental view log to baseline, without DB read / write |
// Merge incremental view log to baseline, without DB read / write |
| 35 |
extern int article_view_log_merge_inc(ARTICLE_VIEW_LOG *p_view_log); |
extern int article_view_log_merge_inc(ARTICLE_VIEW_LOG *p_view_log); |
| 36 |
|
|