| 1 |
sysadm |
1.1 |
/***************************************************************************
|
| 2 |
|
|
article_view_log.h - description
|
| 3 |
|
|
-------------------
|
| 4 |
|
|
Copyright : (C) 2004-2025 by Leaflet
|
| 5 |
|
|
Email : leaflet@leafok.com
|
| 6 |
|
|
***************************************************************************/
|
| 7 |
|
|
|
| 8 |
|
|
/***************************************************************************
|
| 9 |
|
|
* *
|
| 10 |
|
|
* This program is free software; you can redistribute it and/or modify *
|
| 11 |
|
|
* it under the terms of the GNU General Public License as published by *
|
| 12 |
|
|
* the Free Software Foundation; either version 3 of the License, or *
|
| 13 |
|
|
* (at your option) any later version. *
|
| 14 |
|
|
* *
|
| 15 |
|
|
***************************************************************************/
|
| 16 |
|
|
|
| 17 |
|
|
#ifndef _ARTICLE_VIEW_LOG_H_
|
| 18 |
|
|
#define _ARTICLE_VIEW_LOG_H_
|
| 19 |
|
|
|
| 20 |
|
|
#include <stdint.h>
|
| 21 |
|
|
|
| 22 |
|
|
#define MAX_AID_INC_CNT 100000
|
| 23 |
|
|
|
| 24 |
|
|
struct article_view_log_t
|
| 25 |
|
|
{
|
| 26 |
|
|
int32_t *aid_base;
|
| 27 |
|
|
int aid_base_cnt;
|
| 28 |
|
|
int32_t aid_inc[MAX_AID_INC_CNT];
|
| 29 |
|
|
int aid_inc_cnt;
|
| 30 |
|
|
};
|
| 31 |
|
|
typedef struct article_view_log_t ARTICLE_VIEW_LOG;
|
| 32 |
|
|
|
| 33 |
|
|
// Load baseline view log from DB
|
| 34 |
|
|
extern int article_view_log_load(int uid, ARTICLE_VIEW_LOG *p_view_log, int keep_inc);
|
| 35 |
|
|
// Clear data
|
| 36 |
|
|
extern int article_view_log_unload(int uid, ARTICLE_VIEW_LOG *p_view_log);
|
| 37 |
|
|
// Save incremental view log to DB
|
| 38 |
|
|
extern int article_view_log_save_inc(int uid, const ARTICLE_VIEW_LOG *p_view_log);
|
| 39 |
|
|
// Merge incremental view log to baseline, without DB read / write
|
| 40 |
|
|
extern int article_view_log_merge_inc(ARTICLE_VIEW_LOG *p_view_log);
|
| 41 |
|
|
|
| 42 |
|
|
// Check if specific article was viewed
|
| 43 |
|
|
extern int article_view_log_is_viewed(int32_t aid, const ARTICLE_VIEW_LOG *p_view_log);
|
| 44 |
|
|
// Set specific article as viewed
|
| 45 |
|
|
extern int article_view_log_set_viewed(int32_t aid, ARTICLE_VIEW_LOG *p_view_log);
|
| 46 |
|
|
|
| 47 |
|
|
#endif //_ARTICLE_VIEW_LOG_H_
|