| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
article_cache.h - description |
/* |
| 3 |
------------------- |
* article_cache |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - convert article content from DB to local cache with LML conversion and line offset index |
| 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_CACHE_H_ |
#ifndef _ARTICLE_CACHE_H_ |
| 10 |
#define _ARTICLE_CACHE_H_ |
#define _ARTICLE_CACHE_H_ |
| 11 |
|
|
| 12 |
#include "common.h" |
#include "common.h" |
|
#include "str_process.h" |
|
| 13 |
#include "section_list.h" |
#include "section_list.h" |
| 14 |
|
#include "str_process.h" |
| 15 |
|
|
| 16 |
struct article_cache_t |
struct article_cache_t |
| 17 |
{ |
{ |
| 18 |
|
void *p_mmap; |
| 19 |
|
size_t mmap_len; |
| 20 |
char *p_data; |
char *p_data; |
| 21 |
size_t data_len; |
size_t data_len; |
| 22 |
long line_total; |
long line_total; |
| 24 |
}; |
}; |
| 25 |
typedef struct article_cache_t ARTICLE_CACHE; |
typedef struct article_cache_t ARTICLE_CACHE; |
| 26 |
|
|
| 27 |
extern int article_cache_generate(const char *cache_dir, const ARTICLE *p_article, const char *content, int overwrite); |
extern int article_cache_generate(const char *cache_dir, const ARTICLE *p_article, const SECTION_LIST *p_section, |
| 28 |
|
const char *content, const char *sub_ip, int overwrite); |
| 29 |
|
extern void article_cache_cleanup(void); |
| 30 |
|
|
| 31 |
extern int article_cache_load(ARTICLE_CACHE *p_cache, const char *cache_dir, const ARTICLE *p_article); |
extern int article_cache_load(ARTICLE_CACHE *p_cache, const char *cache_dir, const ARTICLE *p_article); |
| 32 |
extern int article_cache_unload(ARTICLE_CACHE *p_cache); |
extern int article_cache_unload(ARTICLE_CACHE *p_cache); |