Debian Codegraph @

lib/grn_dat.h

raw symbols SCIP
1 /*
2 Copyright (C) 2011-2018 Brazil
3 Copyright (C) 2018-2026 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #pragma once
21
22 #include "grn.h"
23 #include "grn_db.h"
24 #include "grn_table_module.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 struct _grn_dat {
31 grn_db_obj obj;
32 grn_io *io;
33 struct grn_dat_header *header;
34 uint32_t file_id;
35 grn_encoding encoding;
36 void *trie;
37 void *old_trie;
38 grn_table_module tokenizer;
39 grn_obj normalizers;
40 grn_obj token_filters;
41 /* For backward compatibility */
42 grn_obj token_filter_procs;
43 grn_obj extractors;
44 grn_critical_section lock;
45 bool is_dirty;
46 };
47
48 struct grn_dat_header {
49 uint32_t flags;
50 grn_encoding encoding;
51 grn_id tokenizer;
52 uint32_t file_id;
53 grn_id normalizer;
54 uint32_t n_dirty_opens;
55 uint64_t wal_id;
56 uint32_t reserved[232];
57 };
58
59 struct _grn_dat_cursor {
60 grn_db_obj obj;
61 grn_dat *dat;
62 void *cursor;
63 const void *key;
64 grn_id curr_rec;
65 };
66
67 GRN_API grn_id
68 grn_dat_curr_id(grn_ctx *ctx, grn_dat *dat);
69
70 /*
71 Currently, grn_dat_truncate() is available if the grn_dat object is
72 associated with a file.
73 */
74 GRN_API grn_rc
75 grn_dat_truncate(grn_ctx *ctx, grn_dat *dat);
76
77 GRN_API const char *
78 _grn_dat_key(grn_ctx *ctx, grn_dat *dat, grn_id id, uint32_t *key_size);
79 GRN_API grn_id
80 grn_dat_next(grn_ctx *ctx, grn_dat *dat, grn_id id);
81 GRN_API grn_id
82 grn_dat_at(grn_ctx *ctx, grn_dat *dat, grn_id id);
83
84 GRN_API grn_rc
85 grn_dat_clear_status_flags(grn_ctx *ctx, grn_dat *dat);
86
87 /*
88 Currently, grn_dat_repair() is available if the grn_dat object is associated
89 with a file.
90 */
91 GRN_API grn_rc
92 grn_dat_repair(grn_ctx *ctx, grn_dat *dat);
93
94 GRN_API grn_rc
95 grn_dat_flush(grn_ctx *ctx, grn_dat *dat);
96
97 bool
98 grn_dat_is_changing(grn_ctx *ctx, grn_dat *dat);
99
100 grn_rc
101 grn_dat_dirty(grn_ctx *ctx, grn_dat *dat);
102 bool
103 grn_dat_is_dirty(grn_ctx *ctx, grn_dat *dat);
104 grn_rc
105 grn_dat_clean(grn_ctx *ctx, grn_dat *dat);
106 grn_rc
107 grn_dat_clear_dirty(grn_ctx *ctx, grn_dat *dat);
108
109 bool
110 grn_dat_is_corrupt(grn_ctx *ctx, grn_dat *dat);
111
112 size_t
113 grn_dat_get_disk_usage(grn_ctx *ctx, grn_dat *dat);
114
115 grn_rc
116 grn_dat_wal_recover(grn_ctx *ctx, grn_dat *dat);
117 grn_rc
118 grn_dat_warm(grn_ctx *ctx, grn_dat *dat);
119
120 #ifdef __cplusplus
121 }
122 #endif