| 1 | /* |
| 2 | Copyright (C) 2009-2018 Brazil |
| 3 | Copyright (C) 2018-2025 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_ctx.h"cxx . . $ `<file>/lib/grn_ctx.h`/ |
| 23 | #include "grn_com.h"cxx . . $ `<file>/lib/grn_com.h`/ |
| 24 | #include "grn_options.h"cxx . . $ `<file>/lib/grn_options.h`/ |
| 25 | #include "grn_msgpack.h"cxx . . $ `<file>/lib/grn_msgpack.h`/ |
| 26 | #include "grn_load.h"cxx . . $ `<file>/lib/grn_load.h`/ |
| 27 | #include "grn_arrow.h"cxx . . $ `<file>/lib/grn_arrow.h`/ |
| 28 | |
| 29 | #ifdef GRN_WITH_MRUBY |
| 30 | # include <mruby.h> |
| 31 | #endif |
| 32 | |
| 33 | #ifdef GRN_WITH_LUAJIT |
| 34 | # include <lauxlib.h> |
| 35 | # include <lualib.h> |
| 36 | #endif |
| 37 | |
| 38 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 39 | extern "C" { |
| 40 | #endif |
| 41 | |
| 42 | /**** grn_expr ****/ |
| 43 | |
| 44 | #define GRN_EXPR_MISSING_NAMEcxx . . $ `lib/grn_ctx_impl.h:44:9`! "expr_missing" |
| 45 | |
| 46 | /**** grn_ctx_impl ****/ |
| 47 | |
| 48 | #define GRN_CTX_INITEDcxx . . $ `lib/grn_ctx_impl.h:48:9`! 0x00 |
| 49 | #define GRN_CTX_QUITTINGcxx . . $ `lib/grn_ctx_impl.h:49:9`! 0x0f |
| 50 | |
| 51 | #define GRN_CTX_N_SEGMENTScxx . . $ `lib/grn_ctx_impl.h:51:9`! 512 |
| 52 | |
| 53 | #ifdef GRN_WITH_MEMORY_DEBUG |
| 54 | typedef struct _grn_alloc_info grn_alloc_info; |
| 55 | struct _grn_alloc_info { |
| 56 | void *address; |
| 57 | bool freed; |
| 58 | size_t size; |
| 59 | char alloc_backtrace[4096]; |
| 60 | char free_backtrace[4096]; |
| 61 | char *file; |
| 62 | int line; |
| 63 | char *func; |
| 64 | grn_alloc_info *next; |
| 65 | }; |
| 66 | #endif |
| 67 | |
| 68 | typedef struct _grn_mrb_datacxx . . $ _grn_mrb_data# grn_mrb_datacxx . . $ grn_mrb_data#; |
| 69 | struct _grn_mrb_datacxx . . $ _grn_mrb_data# { |
| 70 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! initializedcxx . . $ _grn_mrb_data#initialized.; |
| 71 | #ifdef GRN_WITH_MRUBY |
| 72 | mrb_state *state; |
| 73 | char base_directory[PATH_MAX]; |
| 74 | struct RClass *module; |
| 75 | struct RClass *object_class; |
| 76 | grn_hash *checked_procs; |
| 77 | grn_hash *registered_plugins; |
| 78 | struct { |
| 79 | grn_obj from; |
| 80 | grn_obj to; |
| 81 | } buffer; |
| 82 | struct { |
| 83 | struct RClass *time_class; |
| 84 | } builtin; |
| 85 | struct { |
| 86 | struct RClass *operator_class; |
| 87 | } groonga; |
| 88 | #endif |
| 89 | }; |
| 90 | |
| 91 | typedef struct _grn_lua_datacxx . . $ _grn_lua_data# grn_lua_datacxx . . $ grn_lua_data#; |
| 92 | struct _grn_lua_datacxx . . $ _grn_lua_data# { |
| 93 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! initializedcxx . . $ _grn_lua_data#initialized.; |
| 94 | #ifdef GRN_WITH_LUAJIT |
| 95 | lua_State *state; |
| 96 | #endif |
| 97 | }; |
| 98 | |
| 99 | struct _grn_ctx_implcxx . . $ _grn_ctx_impl# { |
| 100 | grn_encodingcxx . . $ grn_encoding# encodingcxx . . $ _grn_ctx_impl#encoding.; |
| 101 | |
| 102 | /* memory pool portion */ |
| 103 | int32_tcxx . . $ int32_t# lifosegcxx . . $ _grn_ctx_impl#lifoseg.; |
| 104 | int32_tcxx . . $ int32_t# currsegcxx . . $ _grn_ctx_impl#currseg.; |
| 105 | grn_critical_sectioncxx . . $ grn_critical_section# lockcxx . . $ _grn_ctx_impl#lock.; |
| 106 | grn_io_mapinfocxx . . $ grn_io_mapinfo# segscxx . . $ _grn_ctx_impl#segs.[GRN_CTX_N_SEGMENTScxx . . $ `lib/grn_ctx_impl.h:51:9`!]; |
| 107 | |
| 108 | #ifdef GRN_WITH_MEMORY_DEBUG |
| 109 | /* memory debug portion */ |
| 110 | grn_alloc_info *alloc_info; |
| 111 | #endif |
| 112 | |
| 113 | /* expression portion */ |
| 114 | grn_objcxx . . $ grn_obj# **stackcxx . . $ _grn_ctx_impl#stack.; |
| 115 | uint32_tcxx . . $ uint32_t# stack_currcxx . . $ _grn_ctx_impl#stack_curr.; |
| 116 | uint32_tcxx . . $ uint32_t# stack_sizecxx . . $ _grn_ctx_impl#stack_size.; |
| 117 | grn_hashcxx . . $ grn_hash# *expr_varscxx . . $ _grn_ctx_impl#expr_vars.; |
| 118 | grn_objcxx . . $ grn_obj# *curr_exprcxx . . $ _grn_ctx_impl#curr_expr.; |
| 119 | grn_objcxx . . $ grn_obj# current_request_idcxx . . $ _grn_ctx_impl#current_request_id.; |
| 120 | void *current_request_timer_idcxx . . $ _grn_ctx_impl#current_request_timer_id.; |
| 121 | grn_objcxx . . $ grn_obj# expr_parserscxx . . $ _grn_ctx_impl#expr_parsers.; |
| 122 | grn_timevalcxx . . $ grn_timeval# tvcxx . . $ _grn_ctx_impl#tv.; |
| 123 | grn_selector_datacxx . . $ grn_selector_data# *current_selector_datacxx . . $ _grn_ctx_impl#current_selector_data.; |
| 124 | |
| 125 | /* loader portion */ |
| 126 | grn_loadercxx . . $ grn_loader# loadercxx . . $ _grn_ctx_impl#loader.; |
| 127 | grn_arrow_stream_loadercxx . . $ grn_arrow_stream_loader# *arrow_stream_loadercxx . . $ _grn_ctx_impl#arrow_stream_loader.; |
| 128 | |
| 129 | /* plugin portion */ |
| 130 | const char *plugin_pathcxx . . $ _grn_ctx_impl#plugin_path.; |
| 131 | |
| 132 | /* output portion */ |
| 133 | structcxx . . $ _grn_ctx_impl#$anonymous_type_0# { |
| 134 | grn_objcxx . . $ grn_obj# *bufcxx . . $ _grn_ctx_impl#$anonymous_type_0#buf.; |
| 135 | grn_recv_handler_funccxx . . $ grn_recv_handler_func# funccxx . . $ _grn_ctx_impl#$anonymous_type_0#func.; |
| 136 | unioncxx . . $ _grn_ctx_impl#$anonymous_type_0#$anonymous_type_1# { |
| 137 | void *ptrcxx . . $ _grn_ctx_impl#$anonymous_type_0#$anonymous_type_1#ptr.; |
| 138 | int fdcxx . . $ _grn_ctx_impl#$anonymous_type_0#$anonymous_type_1#fd.; |
| 139 | uint32_tcxx . . $ uint32_t# u32cxx . . $ _grn_ctx_impl#$anonymous_type_0#$anonymous_type_1#u32.; |
| 140 | uint64_tcxx . . $ uint64_t# u64cxx . . $ _grn_ctx_impl#$anonymous_type_0#$anonymous_type_1#u64.; |
| 141 | } datacxx . . $ _grn_ctx_impl#$anonymous_type_0#data.; |
| 142 | grn_content_typecxx . . $ grn_content_type# typecxx . . $ _grn_ctx_impl#$anonymous_type_0#type.; |
| 143 | const char *mime_typecxx . . $ _grn_ctx_impl#$anonymous_type_0#mime_type.; |
| 144 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_prettycxx . . $ _grn_ctx_impl#$anonymous_type_0#is_pretty.; |
| 145 | grn_objcxx . . $ grn_obj# namescxx . . $ _grn_ctx_impl#$anonymous_type_0#names.; |
| 146 | grn_objcxx . . $ grn_obj# levelscxx . . $ _grn_ctx_impl#$anonymous_type_0#levels.; |
| 147 | #ifdef GRN_WITH_MESSAGE_PACKcxx . . $ `build/config.h:108:9`! |
| 148 | msgpack_packercxx . . $ msgpack_packer# msgpackercxx . . $ _grn_ctx_impl#$anonymous_type_0#msgpacker.; |
| 149 | #endif |
| 150 | grn_arrow_stream_writercxx . . $ grn_arrow_stream_writer# *arrow_stream_writercxx . . $ _grn_ctx_impl#$anonymous_type_0#arrow_stream_writer.; |
| 151 | } outputcxx . . $ _grn_ctx_impl#output.; |
| 152 | |
| 153 | structcxx . . $ _grn_ctx_impl#$anonymous_type_2# { |
| 154 | int32_tcxx . . $ int32_t# n_workerscxx . . $ _grn_ctx_impl#$anonymous_type_2#n_workers.; |
| 155 | void *task_executorcxx . . $ _grn_ctx_impl#$anonymous_type_2#task_executor.; |
| 156 | } parallelcxx . . $ _grn_ctx_impl#parallel.; |
| 157 | |
| 158 | structcxx . . $ _grn_ctx_impl#$anonymous_type_3# { |
| 159 | int flagscxx . . $ _grn_ctx_impl#$anonymous_type_3#flags.; |
| 160 | grn_command_versioncxx . . $ grn_command_version# versioncxx . . $ _grn_ctx_impl#$anonymous_type_3#version.; |
| 161 | structcxx . . $ _grn_ctx_impl#$anonymous_type_3#$anonymous_type_4# { |
| 162 | grn_objcxx . . $ grn_obj# *commandcxx . . $ _grn_ctx_impl#$anonymous_type_3#$anonymous_type_4#command.; |
| 163 | grn_command_versioncxx . . $ grn_command_version# versioncxx . . $ _grn_ctx_impl#$anonymous_type_3#$anonymous_type_4#version.; |
| 164 | int32_tcxx . . $ int32_t# n_workerscxx . . $ _grn_ctx_impl#$anonymous_type_3#$anonymous_type_4#n_workers.; |
| 165 | } keepcxx . . $ _grn_ctx_impl#$anonymous_type_3#keep.; |
| 166 | } commandcxx . . $ _grn_ctx_impl#command.; |
| 167 | |
| 168 | /* match escalation portion */ |
| 169 | int64_tcxx . . $ int64_t# match_escalation_thresholdcxx . . $ _grn_ctx_impl#match_escalation_threshold.; |
| 170 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! force_match_escalationcxx . . $ _grn_ctx_impl#force_match_escalation.; |
| 171 | |
| 172 | /* lifetime portion */ |
| 173 | grn_proc_funccxx . . $ grn_proc_func# *finalizercxx . . $ _grn_ctx_impl#finalizer.; |
| 174 | |
| 175 | grn_objcxx . . $ grn_obj# *dbcxx . . $ _grn_ctx_impl#db.; |
| 176 | grn_arraycxx . . $ grn_array# *valuescxx . . $ _grn_ctx_impl#values.; /* temporary objects */ |
| 177 | grn_patcxx . . $ grn_pat# *temporary_columnscxx . . $ _grn_ctx_impl#temporary_columns.; |
| 178 | grn_optionscxx . . $ grn_options# *temporary_optionscxx . . $ _grn_ctx_impl#temporary_options.; |
| 179 | grn_critical_sectioncxx . . $ grn_critical_section# columns_cache_lockcxx . . $ _grn_ctx_impl#columns_cache_lock.; |
| 180 | grn_hashcxx . . $ grn_hash# *columns_cachecxx . . $ _grn_ctx_impl#columns_cache.; |
| 181 | grn_hashcxx . . $ grn_hash# *ioscxx . . $ _grn_ctx_impl#ios.; /* IOs */ |
| 182 | grn_comcxx . . $ grn_com# *comcxx . . $ _grn_ctx_impl#com.; |
| 183 | unsigned int com_statuscxx . . $ _grn_ctx_impl#com_status.; |
| 184 | |
| 185 | grn_objcxx . . $ grn_obj# query_log_bufcxx . . $ _grn_ctx_impl#query_log_buf.; |
| 186 | |
| 187 | char previous_errbufcxx . . $ _grn_ctx_impl#previous_errbuf.[GRN_CTX_MSGSIZEcxx . . $ `include/groonga/groonga.h:334:9`!]; |
| 188 | unsigned int n_same_error_messagescxx . . $ _grn_ctx_impl#n_same_error_messages.; |
| 189 | |
| 190 | structcxx . . $ _grn_ctx_impl#$anonymous_type_5# { |
| 191 | grn_objcxx . . $ grn_obj# start_timescxx . . $ _grn_ctx_impl#$anonymous_type_5#start_times.; |
| 192 | } slow_logcxx . . $ _grn_ctx_impl#slow_log.; |
| 193 | |
| 194 | grn_mrb_datacxx . . $ grn_mrb_data# mrbcxx . . $ _grn_ctx_impl#mrb.; |
| 195 | grn_lua_datacxx . . $ grn_lua_data# luacxx . . $ _grn_ctx_impl#lua.; |
| 196 | |
| 197 | structcxx . . $ _grn_ctx_impl#$anonymous_type_6# { |
| 198 | grn_objcxx . . $ grn_obj# stackcxx . . $ _grn_ctx_impl#$anonymous_type_6#stack.; |
| 199 | grn_objcxx . . $ grn_obj# *currentcxx . . $ _grn_ctx_impl#$anonymous_type_6#current.; |
| 200 | } temporary_open_spacescxx . . $ _grn_ctx_impl#temporary_open_spaces.; |
| 201 | |
| 202 | grn_hashcxx . . $ grn_hash# *variablescxx . . $ _grn_ctx_impl#variables.; |
| 203 | |
| 204 | structcxx . . $ _grn_ctx_impl#$anonymous_type_7# { |
| 205 | grn_wal_rolecxx . . $ grn_wal_role# rolecxx . . $ _grn_ctx_impl#$anonymous_type_7#role.; |
| 206 | } walcxx . . $ _grn_ctx_impl#wal.; |
| 207 | |
| 208 | structcxx . . $ _grn_ctx_impl#$anonymous_type_8# { |
| 209 | grn_critical_sectioncxx . . $ grn_critical_section# lockcxx . . $ _grn_ctx_impl#$anonymous_type_8#lock.; |
| 210 | grn_objcxx . . $ grn_obj# poolcxx . . $ _grn_ctx_impl#$anonymous_type_8#pool.; |
| 211 | } childrencxx . . $ _grn_ctx_impl#children.; |
| 212 | grn_ctxcxx . . $ grn_ctx# *parentcxx . . $ _grn_ctx_impl#parent.; |
| 213 | grn_critical_sectioncxx . . $ grn_critical_section# temporary_objects_lockcxx . . $ _grn_ctx_impl#temporary_objects_lock.; |
| 214 | |
| 215 | structcxx . . $ _grn_ctx_impl#$anonymous_type_9# { |
| 216 | grn_progress_callback_funccxx . . $ grn_progress_callback_func# callbackcxx . . $ _grn_ctx_impl#$anonymous_type_9#callback.; |
| 217 | void *user_datacxx . . $ _grn_ctx_impl#$anonymous_type_9#user_data.; |
| 218 | } progresscxx . . $ _grn_ctx_impl#progress.; |
| 219 | |
| 220 | structcxx . . $ _grn_ctx_impl#$anonymous_type_10# { |
| 221 | uint64_tcxx . . $ uint64_t# start_timecxx . . $ _grn_ctx_impl#$anonymous_type_10#start_time.; |
| 222 | uint16_tcxx . . $ uint16_t# current_depthcxx . . $ _grn_ctx_impl#$anonymous_type_10#current_depth.; |
| 223 | grn_objcxx . . $ grn_obj# depthscxx . . $ _grn_ctx_impl#$anonymous_type_10#depths.; |
| 224 | grn_objcxx . . $ grn_obj# sequence_stackcxx . . $ _grn_ctx_impl#$anonymous_type_10#sequence_stack.; |
| 225 | grn_objcxx . . $ grn_obj# sequencescxx . . $ _grn_ctx_impl#$anonymous_type_10#sequences.; |
| 226 | grn_objcxx . . $ grn_obj# namescxx . . $ _grn_ctx_impl#$anonymous_type_10#names.; |
| 227 | grn_objcxx . . $ grn_obj# valuescxx . . $ _grn_ctx_impl#$anonymous_type_10#values.; |
| 228 | /* in nano seconds */ |
| 229 | grn_objcxx . . $ grn_obj# elapsed_timescxx . . $ _grn_ctx_impl#$anonymous_type_10#elapsed_times.; |
| 230 | } trace_logcxx . . $ _grn_ctx_impl#trace_log.; |
| 231 | }; |
| 232 | |
| 233 | #define GRN_CTX_GET_WAL_ROLEcxx . . $ `lib/grn_ctx_impl.h:233:9`!(ctx) ((ctx)->impl->wal.role) |
| 234 | |
| 235 | static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 236 | grn_ctx_trace_log_is_enabledcxx . . $ grn_ctx_trace_log_is_enabled(6769dd2542d68818).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 237 | { |
| 238 | if (!ctx) { |
| 239 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 240 | } |
| 241 | if (!ctx->implcxx . . $ _grn_ctx#impl.) { |
| 242 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 243 | } |
| 244 | return ctx->implcxx . . $ _grn_ctx#impl.->trace_logcxx . . $ _grn_ctx_impl#trace_log..start_timecxx . . $ _grn_ctx_impl#$anonymous_type_10#start_time. != 0; |
| 245 | } |
| 246 | |
| 247 | void |
| 248 | grn_ctx_impl_columns_cache_deletecxx . . $ grn_ctx_impl_columns_cache_delete(969b9cdb234920c4).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_idcxx . . $ grn_id# table_id); |
| 249 | void |
| 250 | grn_ctx_impl_columns_cache_clearcxx . . $ grn_ctx_impl_columns_cache_clear(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 251 | |
| 252 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 253 | } |
| 254 | #endif |