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

Annotation of /lbbs/include/trie_dict.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations)
Wed Nov 19 15:50:13 2025 UTC (3 months, 3 weeks ago) by sysadm
Branch: MAIN
Changes since 1.9: +2 -1 lines
Content type: text/x-chdr
Use POSIX shared object instead of SysV shared segment in trie_dict

1 sysadm 1.7 /* SPDX-License-Identifier: GPL-3.0-or-later */
2     /*
3     * trie_dict
4     * - trie-tree based dict feature
5     *
6 sysadm 1.8 * Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com>
7 sysadm 1.7 */
8 sysadm 1.1
9     #ifndef _TRIE_DICT_H_
10     #define _TRIE_DICT_H_
11    
12     #include <stdint.h>
13    
14 sysadm 1.9 enum trie_dict_constant_t
15     {
16     TRIE_CHILDREN = 256,
17     TRIE_MAX_KEY_LEN = 1023,
18     TRIE_NODE_PER_POOL = 5000,
19     };
20 sysadm 1.1
21     struct trie_node_t
22     {
23     int64_t values[TRIE_CHILDREN];
24     int8_t flags[TRIE_CHILDREN];
25     struct trie_node_t *p_nodes[TRIE_CHILDREN];
26     };
27     typedef struct trie_node_t TRIE_NODE;
28    
29 sysadm 1.2 typedef void (*trie_dict_traverse_cb)(const char *, int64_t);
30    
31 sysadm 1.5 extern int trie_dict_init(const char *filename, int node_count_limit);
32 sysadm 1.10 extern int trie_dict_cleanup(void);
33 sysadm 1.4
34 sysadm 1.10 extern int get_trie_dict_shm_readonly(void);
35 sysadm 1.4 extern int set_trie_dict_shm_readonly(void);
36     extern int detach_trie_dict_shm(void);
37    
38 sysadm 1.1 extern TRIE_NODE *trie_dict_create(void);
39     extern void trie_dict_destroy(TRIE_NODE *p_dict);
40    
41     extern int trie_dict_set(TRIE_NODE *p_dict, const char *key, int64_t value);
42     extern int trie_dict_get(TRIE_NODE *p_dict, const char *key, int64_t *p_value);
43     extern int trie_dict_del(TRIE_NODE *p_dict, const char *key);
44    
45 sysadm 1.2 extern void trie_dict_traverse(TRIE_NODE *p_dict, trie_dict_traverse_cb cb);
46    
47 sysadm 1.5 extern int trie_dict_used_nodes(void);
48    
49 sysadm 1.1 #endif //_TRIE_DICT_H_

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