Debian Codegraph @

lib/proc/proc_object_inspect.c

raw symbols SCIP
1 /*
2 Copyright (C) 2016-2017 Brazil
3 Copyright (C) 2019-2024 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 #include "../grn_pat.h"cxx . . $ `<file>/lib/grn_pat.h`/
21 #include "../grn_dat.h"cxx . . $ `<file>/lib/grn_dat.h`/
22 #include "../grn_ii.h"cxx . . $ `<file>/lib/grn_ii.h`/
23
24 #include "../grn_proc.h"cxx . . $ `<file>/lib/grn_proc.h`/
25
26 #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/
27
28 static void
29 command_object_inspect_dispatchcxx . . $ command_object_inspect_dispatch(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj);
30
31 static void
32 command_object_inspect_obj_namecxx . . $ command_object_inspect_obj_name(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj)
33 {
34 char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!];
35 int name_size;
36
37 name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, obj, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!);
38 grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx, name, (size_t)name_size);
39 }
40
41 static void
42 command_object_inspect_obj_typecxx . . $ command_object_inspect_obj_type(f33f77cd46f8f264).(grn_ctxcxx . . $ grn_ctx# *ctx, uint8_tcxx . . $ uint8_t# type)
43 {
44 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "type", 2);
45 {
46 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
47 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, type);
48 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
49 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, grn_obj_type_to_stringcxx . . $ grn_obj_type_to_string(42624c5f3be67010).(type));
50 }
51 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
52 }
53
54 static void
55 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *type)
56 {
57 if (!type) {
58 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
59 return;
60 }
61
62 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "type", 4);
63 {
64 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
65 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_obj_idcxx . . $ grn_obj_id(8dd58acc9865e889).(ctx, type));
66 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
67 command_object_inspect_obj_namecxx . . $ command_object_inspect_obj_name(cda3a5f3c2e53c6b).(ctx, type);
68 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
69 command_object_inspect_obj_typecxx . . $ command_object_inspect_obj_type(f33f77cd46f8f264).(ctx, type->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.);
70 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "size");
71 if (type->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TYPEcxx . . $ `include/groonga/groonga.h:892:9`!) {
72 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_type_sizecxx . . $ grn_type_size(8dd58acc9865e889).(ctx, type));
73 } else {
74 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, sizeof(grn_idcxx . . $ grn_id#));
75 }
76 }
77 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
78 }
79
80 static void
81 command_object_inspect_disk_usagecxx . . $ command_object_inspect_disk_usage(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj)
82 {
83 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_obj_get_disk_usagecxx . . $ grn_obj_get_disk_usage(2ef1bf33a3428727).(ctx, obj));
84 }
85
86 static void
87 command_object_inspect_table_hash_key_keycxx . . $ command_object_inspect_table_hash_key_key(57c8ed80822320b7).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_hashcxx . . $ grn_hash# *hash)
88 {
89 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "key", 3);
90 {
91 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
92 grn_objcxx . . $ grn_obj# *type = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, hash->objcxx . . $ _grn_hash#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain.);
93 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(ctx, type);
94 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, type);
95 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "total_size");
96 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_hash_total_key_sizecxx . . $ grn_hash_total_key_size(4f735bb6d75b18a1).(ctx, hash));
97 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_total_size");
98 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_hash_max_total_key_sizecxx . . $ grn_hash_max_total_key_size(4f735bb6d75b18a1).(ctx, hash));
99 }
100 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
101 }
102
103 static void
104 command_object_inspect_table_pat_key_keycxx . . $ command_object_inspect_table_pat_key_key(ff189d7ae511a139).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
105 {
106 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "key", 3);
107 {
108 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
109 grn_objcxx . . $ grn_obj# *type = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain.);
110 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(ctx, type);
111 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, type);
112 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "total_size");
113 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(ctx, pat));
114 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_total_size");
115 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_pat_max_total_key_sizecxx . . $ grn_pat_max_total_key_size(3626315f4fc444a).(ctx, pat));
116 }
117 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
118 }
119
120 static void
121 command_object_inspect_table_dat_key_keycxx . . $ command_object_inspect_table_dat_key_key(e79ecd4e4b1242ae).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_datcxx . . $ grn_dat# *dat)
122 {
123 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "key", 1);
124 {
125 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
126 grn_objcxx . . $ grn_obj# *type = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, dat->objcxx . . $ _grn_dat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain.);
127 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(ctx, type);
128 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, type);
129 }
130 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
131 }
132
133 static void
134 command_object_inspect_table_keycxx . . $ command_object_inspect_table_key(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *table)
135 {
136 switch (table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
137 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
138 command_object_inspect_table_hash_key_keycxx . . $ command_object_inspect_table_hash_key_key(57c8ed80822320b7).(ctx, (grn_hashcxx . . $ grn_hash# *)table);
139 break;
140 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
141 command_object_inspect_table_pat_key_keycxx . . $ command_object_inspect_table_pat_key_key(ff189d7ae511a139).(ctx, (grn_patcxx . . $ grn_pat# *)table);
142 break;
143 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
144 command_object_inspect_table_dat_key_keycxx . . $ command_object_inspect_table_dat_key_key(e79ecd4e4b1242ae).(ctx, (grn_datcxx . . $ grn_dat# *)table);
145 break;
146 case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!:
147 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
148 break;
149 default:
150 break;
151 }
152 }
153
154 static void
155 command_object_inspect_table_valuecxx . . $ command_object_inspect_table_value(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *table)
156 {
157 if (table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!) {
158 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
159 } else {
160 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "value", 1);
161 {
162 grn_idcxx . . $ grn_id# range_id = grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, table);
163 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
164 grn_objcxx . . $ grn_obj# *type = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id);
165 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(ctx, type);
166 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, type);
167 }
168 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
169 }
170 }
171
172 static void
173 command_object_inspect_tablecxx . . $ command_object_inspect_table(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj)
174 {
175 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "table", 7);
176 {
177 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
178 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_obj_idcxx . . $ grn_obj_id(8dd58acc9865e889).(ctx, obj));
179 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
180 command_object_inspect_obj_namecxx . . $ command_object_inspect_obj_name(cda3a5f3c2e53c6b).(ctx, obj);
181 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
182 command_object_inspect_obj_typecxx . . $ command_object_inspect_obj_type(f33f77cd46f8f264).(ctx, obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.);
183 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "key");
184 command_object_inspect_table_keycxx . . $ command_object_inspect_table_key(cda3a5f3c2e53c6b).(ctx, obj);
185 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "value");
186 command_object_inspect_table_valuecxx . . $ command_object_inspect_table_value(cda3a5f3c2e53c6b).(ctx, obj);
187 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "n_records");
188 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_table_sizecxx . . $ grn_table_size(8dd58acc9865e889).(ctx, obj));
189 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "disk_usage");
190 command_object_inspect_disk_usagecxx . . $ command_object_inspect_disk_usage(cda3a5f3c2e53c6b).(ctx, obj);
191 }
192 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
193 }
194
195 static void
196 command_object_inspect_column_namecxx . . $ command_object_inspect_column_name(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
197 {
198 char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!];
199 int name_size;
200
201 name_size = grn_column_namecxx . . $ grn_column_name(a51d1bff955f2f21).(ctx, column, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!);
202 name[name_size] = '\0';
203 grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx, name, (size_t)name_size);
204 }
205
206 static void
207 command_object_inspect_column_type_namecxx . . $ command_object_inspect_column_type_name(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
208 {
209 switch (column->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
210 case GRN_COLUMN_FIX_SIZEcxx . . $ `include/groonga/groonga.h:900:9`!:
211 case GRN_COLUMN_VAR_SIZEcxx . . $ `include/groonga/groonga.h:901:9`!:
212 switch (column->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_COLUMN_TYPE_MASKcxx . . $ `include/groonga/groonga.h:726:9`!) {
213 case GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`!:
214 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "scalar");
215 break;
216 case GRN_OBJ_COLUMN_VECTORcxx . . $ `include/groonga/groonga.h:736:9`!:
217 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "vector");
218 break;
219 }
220 break;
221 case GRN_COLUMN_INDEXcxx . . $ `include/groonga/groonga.h:902:9`!:
222 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "index");
223 break;
224 default:
225 break;
226 }
227 }
228
229 static void
230 command_object_inspect_column_typecxx . . $ command_object_inspect_column_type(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
231 {
232 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "type", 2);
233 {
234 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
235 command_object_inspect_column_type_namecxx . . $ command_object_inspect_column_type_name(cda3a5f3c2e53c6b).(ctx, column);
236
237 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "raw");
238 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "raw", 2);
239 {
240 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
241 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, column->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.);
242 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
243 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, grn_obj_type_to_stringcxx . . $ grn_obj_type_to_string(42624c5f3be67010).(column->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.));
244 }
245 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
246 }
247 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
248 }
249
250 static void
251 command_object_inspect_column_index_value_statisticscxx . . $ command_object_inspect_column_index_value_statistics(f4cfcdc6df3dda31).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_iicxx . . $ grn_ii# *ii)
252 {
253 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "statistics", 13);
254 {
255 grn_ii_header_commoncxx . . $ grn_ii_header_common# *h = ii->headercxx . . $ _grn_ii#header..commoncxx . . $ _grn_ii#$anonymous_type_0#common.;
256
257 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_section_id");
258 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_ii_max_sectioncxx . . $ grn_ii_max_section(25a882c459388016).(ii));
259
260 {
261 uint32_tcxx . . $ uint32_t# max_id = 0;
262 uint32_tcxx . . $ uint32_t# n_garbage_segments = 0;
263 uint32_tcxx . . $ uint32_t# n_array_segments = 0;
264 uint32_tcxx . . $ uint32_t# n_buffer_segments = 0;
265
266 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "n_garbage_segments");
267 {
268 uint32_tcxx . . $ uint32_t# i;
269
270 for (i = h->bgqtailcxx . . $ _grn_ii_header_common#bgqtail.; i != h->bgqheadcxx . . $ _grn_ii_header_common#bgqhead.;
271 i = ((i + 1) & (GRN_II_BGQSIZEcxx . . $ `lib/grn_ii.h:57:9`! - 1))) {
272 uint32_tcxx . . $ uint32_t# id = h->bgqbodycxx . . $ _grn_ii_header_common#bgqbody.[i];
273 n_garbage_segments++;
274 if (id > max_id) {
275 max_id = id;
276 }
277 }
278 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, n_garbage_segments);
279 }
280
281 const uint32_tcxx . . $ uint32_t# n_logical_segments = grn_ii_n_logical_segmentscxx . . $ grn_ii_n_logical_segments(25a882c459388016).(ii);
282 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_array_segment_id");
283 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, h->amaxcxx . . $ _grn_ii_header_common#amax.);
284 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "n_array_segments");
285 {
286 for (uint32_tcxx . . $ uint32_t# lseg = 0; lseg < n_logical_segments; lseg++) {
287 const uint32_tcxx . . $ uint32_t# pseg = grn_ii_get_array_psegcxx . . $ grn_ii_get_array_pseg(ec37801a22cc7640).(ii, lseg);
288 if (pseg != GRN_II_PSEG_NOT_ASSIGNEDcxx . . $ `lib/grn_ii.h:85:9`!) {
289 if (pseg > max_id) {
290 max_id = pseg;
291 }
292 n_array_segments++;
293 }
294 }
295 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, n_array_segments);
296 }
297
298 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_buffer_segment_id");
299 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, h->bmaxcxx . . $ _grn_ii_header_common#bmax.);
300 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "n_buffer_segments");
301 {
302 for (uint32_tcxx . . $ uint32_t# lseg = 0; lseg < n_logical_segments; lseg++) {
303 const uint32_tcxx . . $ uint32_t# pseg = grn_ii_get_buffer_psegcxx . . $ grn_ii_get_buffer_pseg(ec37801a22cc7640).(ii, lseg);
304 if (pseg != GRN_II_PSEG_NOT_ASSIGNEDcxx . . $ `lib/grn_ii.h:85:9`!) {
305 if (pseg > max_id) {
306 max_id = pseg;
307 }
308 n_buffer_segments++;
309 }
310 }
311 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, n_buffer_segments);
312 }
313
314 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_in_use_physical_segment_id");
315 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, max_id);
316
317 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "n_unmanaged_segments");
318 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx,
319 h->pnextcxx . . $ _grn_ii_header_common#pnext. - n_array_segments - n_buffer_segments -
320 n_garbage_segments);
321 }
322
323 {
324 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "total_chunk_size");
325 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, h->total_chunk_sizecxx . . $ _grn_ii_header_common#total_chunk_size.);
326 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_in_use_chunk_id");
327 {
328 uint32_tcxx . . $ uint32_t# i;
329 uint32_tcxx . . $ uint32_t# max_id;
330
331 for (max_id = 0, i = 0; i < (GRN_II_MAX_CHUNKcxx . . $ `lib/grn_ii.h:70:9`! >> 3); i++) {
332 uint8_tcxx . . $ uint8_t# sub_chunk_info = h->chunkscxx . . $ _grn_ii_header_common#chunks.[i];
333 uint8_tcxx . . $ uint8_t# bit;
334
335 if (sub_chunk_info == 0) {
336 continue;
337 }
338 for (bit = 0; bit < 8; bit++) {
339 if (sub_chunk_info & (1 << bit)) {
340 max_id = (i << 3) + sub_chunk_info;
341 }
342 }
343 }
344 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, max_id);
345 }
346 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "n_garbage_chunks");
347 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx,
348 "n_garbage_chunks",
349 GRN_II_N_CHUNK_VARIATIONcxx . . $ `lib/grn_ii.h:72:9`! + 1);
350 {
351 uint32_tcxx . . $ uint32_t# i;
352 for (i = 0; i <= GRN_II_N_CHUNK_VARIATIONcxx . . $ `lib/grn_ii.h:72:9`!; i++) {
353 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, h->ngarbagescxx . . $ _grn_ii_header_common#ngarbages.[i]);
354 }
355 }
356 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
357 }
358
359 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "next_physical_segment_id");
360 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, h->pnextcxx . . $ _grn_ii_header_common#pnext.);
361
362 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "max_n_physical_segments");
363 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, ii->segcxx . . $ _grn_ii#seg.->headercxx . . $ _grn_io#header.->max_segmentcxx . . $ _grn_io_header#max_segment.);
364 }
365 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
366 }
367
368 static void
369 command_object_inspect_column_data_value_compresscxx . . $ command_object_inspect_column_data_value_compress(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
370 {
371 const char *compress = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
372 grn_column_flagscxx . . $ grn_column_flags# column_flags;
373
374 column_flags = grn_column_get_flagscxx . . $ grn_column_get_flags(8dd58acc9865e889).(ctx, column);
375 switch (column_flags & GRN_OBJ_COMPRESS_MASKcxx . . $ `include/groonga/groonga.h:743:9`!) {
376 case GRN_OBJ_COMPRESS_ZLIBcxx . . $ `include/groonga/groonga.h:749:9`!:
377 compress = "zlib";
378 break;
379 case GRN_OBJ_COMPRESS_LZ4cxx . . $ `include/groonga/groonga.h:754:9`!:
380 compress = "lz4";
381 break;
382 case GRN_OBJ_COMPRESS_ZSTDcxx . . $ `include/groonga/groonga.h:761:9`!:
383 compress = "zstd";
384 break;
385 case GRN_OBJ_COMPRESS_OPENZLcxx . . $ `include/groonga/groonga.h:768:9`!:
386 compress = "openzl";
387 break;
388 default:
389 break;
390 }
391
392 if (compress) {
393 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, compress);
394 } else {
395 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
396 }
397 }
398
399 static void
400 command_object_inspect_column_data_value_compress_filterscxx . . $ command_object_inspect_column_data_value_compress_filters(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx,
401 grn_objcxx . . $ grn_obj# *column)
402 {
403 grn_column_flagscxx . . $ grn_column_flags# column_flags = grn_column_get_flagscxx . . $ grn_column_get_flags(8dd58acc9865e889).(ctx, column);
404 uint32_tcxx . . $ uint32_t# n_filters = 0;
405 if (column_flags & GRN_OBJ_COMPRESS_FILTER_SHUFFLEcxx . . $ `include/groonga/groonga.h:850:9`!) {
406 n_filters++;
407 }
408 if (column_flags & GRN_OBJ_COMPRESS_FILTER_BYTE_DELTAcxx . . $ `include/groonga/groonga.h:851:9`!) {
409 n_filters++;
410 }
411 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "compress_filters", n_filters);
412 if (column_flags & GRN_OBJ_COMPRESS_FILTER_SHUFFLEcxx . . $ `include/groonga/groonga.h:850:9`!) {
413 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "shuffle");
414 }
415 if (column_flags & GRN_OBJ_COMPRESS_FILTER_BYTE_DELTAcxx . . $ `include/groonga/groonga.h:851:9`!) {
416 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "byte_delta");
417 }
418 if (column_flags & GRN_OBJ_COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTEScxx . . $ `include/groonga/groonga.h:853:9`!) {
419 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "truncate_precision_2bytes");
420 } else if (column_flags & GRN_OBJ_COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTEcxx . . $ `include/groonga/groonga.h:852:9`!) {
421 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "truncate_precision_1byte");
422 }
423 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
424 }
425
426 static void
427 command_object_inspect_column_valuecxx . . $ command_object_inspect_column_value(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
428 {
429 int n_elements = 1;
430 grn_column_flagscxx . . $ grn_column_flags# column_flags = grn_column_get_flagscxx . . $ grn_column_get_flags(8dd58acc9865e889).(ctx, column);
431 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_index = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
432 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_vector = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
433 switch (column_flags & GRN_OBJ_COLUMN_TYPE_MASKcxx . . $ `include/groonga/groonga.h:726:9`!) {
434 case GRN_OBJ_COLUMN_VECTORcxx . . $ `include/groonga/groonga.h:736:9`!:
435 is_vector = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
436 break;
437 case GRN_OBJ_COLUMN_INDEXcxx . . $ `include/groonga/groonga.h:741:9`!:
438 is_index = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
439 break;
440 default:
441 break;
442 }
443 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_generated_column = grn_obj_is_generated_columncxx . . $ grn_obj_is_generated_column(a5760e5c319a06ee).(ctx, column);
444
445 if (is_index) {
446 n_elements += 5;
447 } else {
448 n_elements += 2;
449 if (is_vector) {
450 n_elements += 3;
451 }
452 if (is_generated_column) {
453 n_elements += 1;
454 }
455 }
456 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "value", n_elements);
457 {
458 grn_idcxx . . $ grn_id# range_id;
459
460 range_id = grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, column);
461
462 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
463 grn_objcxx . . $ grn_obj# *range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id);
464 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(ctx, range);
465 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, range);
466 if (is_index) {
467 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "section");
468 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, (column_flags & GRN_OBJ_WITH_SECTIONcxx . . $ `include/groonga/groonga.h:777:9`!) != 0);
469 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "weight");
470 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, (column_flags & GRN_OBJ_WITH_WEIGHTcxx . . $ `include/groonga/groonga.h:785:9`!) != 0);
471 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "position");
472 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, (column_flags & GRN_OBJ_WITH_POSITIONcxx . . $ `include/groonga/groonga.h:794:9`!) != 0);
473 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "size");
474 if ((column_flags & GRN_OBJ_INDEX_SMALLcxx . . $ `include/groonga/groonga.h:835:9`!) != 0) {
475 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "small");
476 } else if ((column_flags & GRN_OBJ_INDEX_MEDIUMcxx . . $ `include/groonga/groonga.h:836:9`!) != 0) {
477 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "medium");
478 } else if ((column_flags & GRN_OBJ_INDEX_LARGEcxx . . $ `include/groonga/groonga.h:837:9`!) != 0) {
479 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "large");
480 } else {
481 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "normal");
482 }
483 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "statistics");
484 command_object_inspect_column_index_value_statisticscxx . . $ command_object_inspect_column_index_value_statistics(f4cfcdc6df3dda31).(ctx,
485 (grn_iicxx . . $ grn_ii# *)column);
486 } else {
487 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "compress");
488 command_object_inspect_column_data_value_compresscxx . . $ command_object_inspect_column_data_value_compress(cda3a5f3c2e53c6b).(ctx, column);
489 if (is_vector) {
490 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "weight");
491 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, (column_flags & GRN_OBJ_WITH_WEIGHTcxx . . $ `include/groonga/groonga.h:785:9`!) != 0);
492 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "weight_float32");
493 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, (column_flags & GRN_OBJ_WEIGHT_FLOAT32cxx . . $ `include/groonga/groonga.h:838:9`!) != 0);
494 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "weight_bfloat16");
495 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, (column_flags & GRN_OBJ_WEIGHT_BFLOAT16cxx . . $ `include/groonga/groonga.h:796:9`!) != 0);
496 }
497 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "compress_filters");
498 command_object_inspect_column_data_value_compress_filterscxx . . $ command_object_inspect_column_data_value_compress_filters(cda3a5f3c2e53c6b).(ctx, column);
499 if (is_generated_column) {
500 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "generator");
501 grn_objcxx . . $ grn_obj# generator;
502 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&generator, 0);
503 grn_obj_get_infocxx . . $ grn_obj_get_info(333a81d4a8f20670).(ctx, column, GRN_INFO_GENERATORcxx . . $ GRN_INFO_GENERATOR., &generator);
504 grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx,
505 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&generator),
506 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&generator));
507 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &generator);
508 }
509 }
510 }
511 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
512 }
513
514 static void
515 command_object_inspect_column_sourcescxx . . $ command_object_inspect_column_sources(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
516 {
517 const boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_generated_column = grn_obj_is_generated_columncxx . . $ grn_obj_is_generated_column(a5760e5c319a06ee).(ctx, column);
518 grn_objcxx . . $ grn_obj# *source_table;
519 if (is_generated_column) {
520 source_table = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, column->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
521 } else {
522 source_table = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, column));
523 }
524
525 grn_objcxx . . $ grn_obj# source_ids;
526 GRN_RECORD_INITcxx . . $ `include/groonga/groonga.h:2868:9`!(&source_ids, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
527 grn_obj_get_infocxx . . $ grn_obj_get_info(333a81d4a8f20670).(ctx, column, GRN_INFO_SOURCEcxx . . $ GRN_INFO_SOURCE., &source_ids);
528
529 int n_ids = (int)(GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&source_ids) / sizeof(grn_idcxx . . $ grn_id#));
530 grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "sources", n_ids);
531 int i;
532 for (i = 0; i < n_ids; i++) {
533 grn_idcxx . . $ grn_id# source_id;
534 grn_objcxx . . $ grn_obj# *source;
535
536 source_id = GRN_RECORD_VALUE_ATcxx . . $ `include/groonga/groonga.h:3148:9`!(&source_ids, i);
537 source = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, source_id);
538
539 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "source", 4);
540 {
541 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
542 if (grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, source)) {
543 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
544 } else {
545 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, source_id);
546 }
547
548 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
549 if (grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, source)) {
550 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "_key");
551 } else {
552 command_object_inspect_column_namecxx . . $ command_object_inspect_column_name(cda3a5f3c2e53c6b).(ctx, source);
553 }
554
555 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "table");
556 command_object_inspect_tablecxx . . $ command_object_inspect_table(cda3a5f3c2e53c6b).(ctx, source_table);
557
558 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "full_name");
559 if (grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, source)) {
560 char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!];
561 int name_size;
562 name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, source, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!);
563 name[name_size] = '\0';
564 grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(name, GRN_TABLE_MAX_KEY_SIZE, "._key");
565 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, name);
566 } else {
567 command_object_inspect_obj_namecxx . . $ command_object_inspect_obj_name(cda3a5f3c2e53c6b).(ctx, source);
568 }
569 }
570 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
571
572 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, source);
573 }
574 grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx);
575
576 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &source_ids);
577
578 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, source_table);
579 }
580
581 static void
582 command_object_inspect_columncxx . . $ command_object_inspect_column(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column)
583 {
584 int n_elements = 7;
585 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! have_sources = (grn_obj_is_index_columncxx . . $ grn_obj_is_index_column(a5760e5c319a06ee).(ctx, column) ||
586 grn_obj_is_token_columncxx . . $ grn_obj_is_token_column(a5760e5c319a06ee).(ctx, column) ||
587 grn_obj_is_generated_columncxx . . $ grn_obj_is_generated_column(a5760e5c319a06ee).(ctx, column));
588
589 if (have_sources) {
590 n_elements += 1;
591 }
592 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "column", n_elements);
593 {
594 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "id");
595 grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, grn_obj_idcxx . . $ grn_obj_id(8dd58acc9865e889).(ctx, column));
596 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name");
597 command_object_inspect_column_namecxx . . $ command_object_inspect_column_name(cda3a5f3c2e53c6b).(ctx, column);
598 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "table");
599 grn_objcxx . . $ grn_obj# *table = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, column->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
600 command_object_inspect_tablecxx . . $ command_object_inspect_table(cda3a5f3c2e53c6b).(ctx, table);
601 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, table);
602 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "full_name");
603 command_object_inspect_obj_namecxx . . $ command_object_inspect_obj_name(cda3a5f3c2e53c6b).(ctx, column);
604 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
605 command_object_inspect_column_typecxx . . $ command_object_inspect_column_type(cda3a5f3c2e53c6b).(ctx, column);
606 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "value");
607 command_object_inspect_column_valuecxx . . $ command_object_inspect_column_value(cda3a5f3c2e53c6b).(ctx, column);
608 if (have_sources) {
609 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "sources");
610 command_object_inspect_column_sourcescxx . . $ command_object_inspect_column_sources(cda3a5f3c2e53c6b).(ctx, column);
611 }
612 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "disk_usage");
613 command_object_inspect_disk_usagecxx . . $ command_object_inspect_disk_usage(cda3a5f3c2e53c6b).(ctx, column);
614 }
615 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
616 }
617
618 static void
619 command_object_inspect_dbcxx . . $ command_object_inspect_db(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj)
620 {
621 grn_dbcxx . . $ grn_db# *db = (grn_dbcxx . . $ grn_db# *)obj;
622
623 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "database", 3);
624 {
625 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "type");
626 command_object_inspect_obj_typecxx . . $ command_object_inspect_obj_type(f33f77cd46f8f264).(ctx, obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.);
627 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "name_table");
628 command_object_inspect_dispatchcxx . . $ command_object_inspect_dispatch(cda3a5f3c2e53c6b).(ctx, db->keyscxx . . $ _grn_db#keys.);
629 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "disk_usage");
630 command_object_inspect_disk_usagecxx . . $ command_object_inspect_disk_usage(cda3a5f3c2e53c6b).(ctx, obj);
631 }
632 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
633 }
634
635 static void
636 command_object_inspect_dispatchcxx . . $ command_object_inspect_dispatch(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *obj)
637 {
638 switch (obj->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
639 case GRN_TYPEcxx . . $ `include/groonga/groonga.h:892:9`!:
640 command_object_inspect_typecxx . . $ command_object_inspect_type(cda3a5f3c2e53c6b).(ctx, obj);
641 break;
642 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
643 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
644 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
645 case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!:
646 command_object_inspect_tablecxx . . $ command_object_inspect_table(cda3a5f3c2e53c6b).(ctx, obj);
647 break;
648 case GRN_COLUMN_FIX_SIZEcxx . . $ `include/groonga/groonga.h:900:9`!:
649 case GRN_COLUMN_VAR_SIZEcxx . . $ `include/groonga/groonga.h:901:9`!:
650 case GRN_COLUMN_INDEXcxx . . $ `include/groonga/groonga.h:902:9`!:
651 command_object_inspect_columncxx . . $ command_object_inspect_column(cda3a5f3c2e53c6b).(ctx, obj);
652 break;
653 case GRN_DBcxx . . $ `include/groonga/groonga.h:899:9`!:
654 command_object_inspect_dbcxx . . $ command_object_inspect_db(cda3a5f3c2e53c6b).(ctx, obj);
655 break;
656 default:
657 {
658 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
659 GRN_FUNCTION_NOT_IMPLEMENTED,
660 "[object][inspect] unsupported type: <%s>(%#x)",
661 grn_obj_type_to_string(obj->header.type),
662 obj->header.type);
663 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
664 break;
665 }
666 }
667 }
668
669 static grn_objcxx . . $ grn_obj# *
670 command_object_inspectcxx . . $ command_object_inspect(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
671 int nargs,
672 grn_objcxx . . $ grn_obj# **args,
673 grn_user_datacxx . . $ grn_user_data# *user_data)
674 {
675 grn_objcxx . . $ grn_obj# *name;
676 grn_objcxx . . $ grn_obj# *target;
677 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_unref = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
678
679 name = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "name", -1);
680 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name) == 0) {
681 target = grn_ctx_dbcxx . . $ grn_ctx_db(ddec8e3b1327ceae).(ctx);
682 } else {
683 target = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name), (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name));
684 if (!target) {
685 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
686 GRN_INVALID_ARGUMENT,
687 "[object][inspect] nonexistent target: <%.*s>",
688 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(name),
689 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(name));
690 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
691 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
692 }
693 need_unref = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
694 }
695
696 command_object_inspect_dispatchcxx . . $ command_object_inspect_dispatch(cda3a5f3c2e53c6b).(ctx, target);
697 if (need_unref) {
698 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, target);
699 }
700
701 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
702 }
703
704 void
705 grn_proc_init_object_inspectcxx . . $ grn_proc_init_object_inspect(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
706 {
707 grn_expr_varcxx . . $ grn_expr_var# vars[1];
708
709 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "name", -1);
710 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
711 "object_inspect",
712 -1,
713 command_object_inspectcxx . . $ command_object_inspect(fd082858389c8bb0).,
714 1,
715 vars);
716 }