/usr/include/mysql/server/private
NameSizeModeActions
atomic/-0755rm
data/-0755rm
providers/-0755rm
aligned.h11360644editdlrm
aria_backup.h17870644editdlrm
assume_aligned.h23500644editdlrm
authors.h101410644editdlrm
backup.h17030644editdlrm
bounded_queue.h60930644editdlrm
client_settings.h19350644editdlrm
compat56.h22800644editdlrm
config.h145430644editdlrm
contributors.h48780644editdlrm
create_options.h41930644editdlrm
create_tmp_table.h28080644editdlrm
cset_narrowing.h39680644editdlrm
custom_conf.h10820644editdlrm
datadict.h17000644editdlrm
ddl_log.h128070644editdlrm
debug.h12340644editdlrm
debug_sync.h20460644editdlrm
derived_handler.h23790644editdlrm
derror.h9800644editdlrm
des_key_file.h12360644editdlrm
discover.h15700644editdlrm
dur_prop.h10820644editdlrm
embedded_priv.h17330644editdlrm
events.h47040644editdlrm
event_data_objects.h41870644editdlrm
event_db_repository.h36480644editdlrm
event_parse_data.h28990644editdlrm
event_queue.h34380644editdlrm
event_scheduler.h32900644editdlrm
field.h2223360644editdlrm
field_comp.h11740644editdlrm
filesort.h72830644editdlrm
filesort_utils.h81950644editdlrm
ft_global.h31130644editdlrm
gcalc_slicescan.h172720644editdlrm
gcalc_tools.h119000644editdlrm
grant.h27580644editdlrm
group_by_handler.h35340644editdlrm
gstream.h24370644editdlrm
handler.h1997300644editdlrm
handle_connections_win.h8840644editdlrm
hash.h44520644editdlrm
hash_filo.h56880644editdlrm
ha_handler_stats.h23350644editdlrm
ha_partition.h646960644editdlrm
ha_sequence.h62450644editdlrm
heap.h94800644editdlrm
hostname.h54190644editdlrm
ilist.h72370644editdlrm
init.h8520644editdlrm
innodb_priv.h13190644editdlrm
item.h2831880644editdlrm
item_cmpfunc.h1350710644editdlrm
item_create.h115080644editdlrm
item_func.h1386380644editdlrm
item_geofunc.h396120644editdlrm
item_jsonfunc.h252640644editdlrm
item_row.h52290644editdlrm
item_strfunc.h749950644editdlrm
item_subselect.h590280644editdlrm
item_sum.h726950644editdlrm
item_timefunc.h658960644editdlrm
item_vers.h44130644editdlrm
item_windowfunc.h345560644editdlrm
item_xmlfunc.h46500644editdlrm
json_table.h96670644editdlrm
key.h21320644editdlrm
keycaches.h19950644editdlrm
lex.h298400644editdlrm
lex_charset.h243130644editdlrm
lex_hash.h1431080644editdlrm
lex_ident.h21220644editdlrm
lex_string.h40770644editdlrm
lex_symbol.h13230644editdlrm
lex_token.h426410644editdlrm
lf.h64620644editdlrm
lock.h22200644editdlrm
log.h463700644editdlrm
log_event.h1891060644editdlrm
log_event_data_type.h18900644editdlrm
log_event_old.h198300644editdlrm
log_slow.h24420644editdlrm
maria.h58720644editdlrm
mariadb.h12770644editdlrm
mdl.h385030644editdlrm
mem_root_array.h71060644editdlrm
message.h11950644editdlrm
multi_range_read.h231790644editdlrm
myisam.h175060644editdlrm
myisamchk.h47340644editdlrm
myisammrg.h48970644editdlrm
myisampack.h149290644editdlrm
mysqld.h410630644editdlrm
mysqld_default_groups.h2040644editdlrm
mysqld_suffix.h12010644editdlrm
mysys_err.h30220644editdlrm
my_alarm.h24290644editdlrm
my_apc.h47470644editdlrm
my_atomic.h72810644editdlrm
my_atomic_wrapper.h30510644editdlrm
my_base.h276560644editdlrm
my_bit.h61960644editdlrm
my_bitmap.h55020644editdlrm
my_check_opt.h26180644editdlrm
my_compare.h111940644editdlrm
my_counter.h17210644editdlrm
my_cpu.h48550644editdlrm
my_crypt.h9040644editdlrm
my_decimal.h144890644editdlrm
my_default.h18800644editdlrm
my_handler_errors.h48820644editdlrm
my_json_writer.h185730644editdlrm
my_libwrap.h11830644editdlrm
my_md5.h14860644editdlrm
my_minidump.h8480644editdlrm
my_nosys.h14380644editdlrm
my_rdtsc.h101190644editdlrm
my_rnd.h10140644editdlrm
my_service_manager.h20870644editdlrm
my_stacktrace.h32150644editdlrm
my_stack_alloc.h64930644editdlrm
my_time.h104140644editdlrm
my_tree.h39910644editdlrm
my_uctype.h695280644editdlrm
my_user.h11260644editdlrm
my_virtual_mem.h11270644editdlrm
opt_histogram_json.h46380644editdlrm
opt_range.h659030644editdlrm
opt_subselect.h145450644editdlrm
opt_trace.h84940644editdlrm
opt_trace_context.h32910644editdlrm
parse_file.h43870644editdlrm
partition_element.h54280644editdlrm
partition_info.h198640644editdlrm
password.h11700644editdlrm
pfs_file_provider.h31530644editdlrm
pfs_idle_provider.h13850644editdlrm
pfs_memory_provider.h16260644editdlrm
pfs_metadata_provider.h18980644editdlrm
pfs_socket_provider.h22580644editdlrm
pfs_stage_provider.h15560644editdlrm
pfs_statement_provider.h43470644editdlrm
pfs_table_provider.h26250644editdlrm
pfs_thread_provider.h55600644editdlrm
pfs_transaction_provider.h28460644editdlrm
privilege.h288890644editdlrm
probes_mysql.h9730644editdlrm
probes_mysql_nodtrace.h60870644editdlrm
procedure.h68190644editdlrm
protocol.h125370644editdlrm
proxy_protocol.h5480644editdlrm
queues.h34770644editdlrm
records.h31470644editdlrm
replication.h161300644editdlrm
repl_failsafe.h15850644editdlrm
rijndael.h17110644editdlrm
rowid_filter.h154740644editdlrm
rpl_constants.h33570644editdlrm
rpl_filter.h47740644editdlrm
rpl_gtid.h299390644editdlrm
rpl_injector.h96210644editdlrm
rpl_mi.h166380644editdlrm
rpl_parallel.h182280644editdlrm
rpl_record.h15850644editdlrm
rpl_record_old.h14070644editdlrm
rpl_reporting.h37130644editdlrm
rpl_rli.h360700644editdlrm
rpl_tblmap.h31770644editdlrm
rpl_utility.h96300644editdlrm
scheduler.h31990644editdlrm
scope.h43930644editdlrm
select_handler.h22280644editdlrm
semisync.h22870644editdlrm
semisync_master.h257660644editdlrm
semisync_master_ack_receiver.h87090644editdlrm
semisync_slave.h37360644editdlrm
service_versions.h22850644editdlrm
session_tracker.h142750644editdlrm
set_var.h165510644editdlrm
slave.h122750644editdlrm
socketpair.h8420644editdlrm
source_revision.h670644editdlrm
sp.h225880644editdlrm
span.h39310644editdlrm
spatial.h226980644editdlrm
sp_cache.h20370644editdlrm
sp_head.h649170644editdlrm
sp_pcontext.h248930644editdlrm
sp_rcontext.h144410644editdlrm
sql_acl.h141670644editdlrm
sql_admin.h29150644editdlrm
sql_alloc.h17320644editdlrm
sql_alter.h153950644editdlrm
sql_analyse.h111250644editdlrm
sql_analyze_stmt.h126830644editdlrm
sql_array.h68580644editdlrm
sql_audit.h141620644editdlrm
sql_base.h260410644editdlrm
sql_basic_types.h95230644editdlrm
sql_binlog.h8950644editdlrm
sql_bitmap.h78420644editdlrm
sql_bootstrap.h18120644editdlrm
sql_cache.h216760644editdlrm
sql_callback.h15420644editdlrm
sql_class.h2711200644editdlrm
sql_cmd.h59620644editdlrm
sql_command.h48000644editdlrm
sql_connect.h40870644editdlrm
sql_const.h114150644editdlrm
sql_crypt.h14370644editdlrm
sql_cte.h164940644editdlrm
sql_cursor.h42390644editdlrm
sql_db.h24380644editdlrm
sql_debug.h56460644editdlrm
sql_delete.h13430644editdlrm
sql_derived.h12890644editdlrm
sql_digest.h38190644editdlrm
sql_digest_stream.h15670644editdlrm
sql_do.h9540644editdlrm
sql_error.h398430644editdlrm
sql_explain.h303190644editdlrm
sql_expression_cache.h43590644editdlrm
sql_get_diagnostics.h78830644editdlrm
sql_handler.h29100644editdlrm
sql_help.h9950644editdlrm
sql_hset.h34010644editdlrm
sql_insert.h51730644editdlrm
sql_i_s.h84870644editdlrm
sql_join_cache.h486590644editdlrm
sql_lex.h1746930644editdlrm
sql_lifo_buffer.h96760644editdlrm
sql_limit.h31870644editdlrm
sql_list.h223910644editdlrm
sql_load.h12760644editdlrm
sql_locale.h27010644editdlrm
sql_manager.h9600644editdlrm
sql_mode.h67350644editdlrm
sql_parse.h89700644editdlrm
sql_partition.h126740644editdlrm
sql_partition_admin.h59400644editdlrm
sql_plist.h77110644editdlrm
sql_plugin.h75770644editdlrm
sql_plugin_compat.h22370644editdlrm
sql_prepare.h114090644editdlrm
sql_priv.h184740644editdlrm
sql_profile.h78160644editdlrm
sql_reload.h10360644editdlrm
sql_rename.h9820644editdlrm
sql_repl.h30450644editdlrm
sql_schema.h33030644editdlrm
sql_select.h897430644editdlrm
sql_sequence.h51770644editdlrm
sql_servers.h17770644editdlrm
sql_show.h98300644editdlrm
sql_signal.h33620644editdlrm
sql_sort.h219640644editdlrm
sql_statistics.h164940644editdlrm
sql_string.h390090644editdlrm
sql_table.h97520644editdlrm
sql_test.h15890644editdlrm
sql_time.h83740644editdlrm
sql_trigger.h123320644editdlrm
sql_truncate.h20790644editdlrm
sql_tvc.h24180644editdlrm
sql_type.h2960720644editdlrm
sql_type_fixedbin.h655780644editdlrm
sql_type_fixedbin_storage.h54670644editdlrm
sql_type_geom.h190390644editdlrm
sql_type_int.h100010644editdlrm
sql_type_json.h61550644editdlrm
sql_type_real.h12570644editdlrm
sql_type_string.h16290644editdlrm
sql_udf.h48500644editdlrm
sql_union.h10680644editdlrm
sql_update.h19230644editdlrm
sql_view.h24700644editdlrm
sql_window.h68140644editdlrm
ssl_compat.h33800644editdlrm
strfunc.h22750644editdlrm
structs.h295300644editdlrm
sys_vars_shared.h27290644editdlrm
table.h1184140644editdlrm
table_cache.h42320644editdlrm
threadpool.h48100644editdlrm
threadpool_generic.h39690644editdlrm
threadpool_winsockets.h22900644editdlrm
thread_cache.h59050644editdlrm
thr_alarm.h29320644editdlrm
thr_lock.h73500644editdlrm
thr_malloc.h12020644editdlrm
thr_timer.h15630644editdlrm
transaction.h14660644editdlrm
tzfile.h50140644editdlrm
tztime.h33970644editdlrm
t_ctype.h56390644editdlrm
uniques.h42170644editdlrm
unireg.h77220644editdlrm
vers_string.h25430644editdlrm
violite.h100860644editdlrm
waiting_threads.h45320644editdlrm
welcome_copyright_notice.h12180644editdlrm
winservice.h60190644editdlrm
win_tzname_data.h65060644editdlrm
wqueue.h15650644editdlrm
wsrep.h33080644editdlrm
wsrep_allowlist_service.h10350644editdlrm
wsrep_applier.h27030644editdlrm
wsrep_binlog.h35510644editdlrm
wsrep_client_service.h25600644editdlrm
wsrep_client_state.h15660644editdlrm
wsrep_condition_variable.h14840644editdlrm
wsrep_high_priority_service.h49120644editdlrm
wsrep_mutex.h12390644editdlrm
wsrep_mysqld.h215240644editdlrm
wsrep_mysqld_c.h12270644editdlrm
wsrep_on.h17180644editdlrm
wsrep_priv.h16340644editdlrm
wsrep_schema.h56080644editdlrm
wsrep_server_service.h36310644editdlrm
wsrep_server_state.h25290644editdlrm
wsrep_sst.h39510644editdlrm
wsrep_status.h18160644editdlrm
wsrep_storage_service.h18090644editdlrm
wsrep_thd.h114870644editdlrm
wsrep_trans_observer.h181740644editdlrm
wsrep_types.h11100644editdlrm
wsrep_utils.h98070644editdlrm
wsrep_var.h44910644editdlrm
wsrep_xid.h15490644editdlrm
xa.h18450644editdlrm
Edit: /usr/include/mysql/server/private/bounded_queue.h (6093B)
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 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; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ #ifndef BOUNDED_QUEUE_INCLUDED #define BOUNDED_QUEUE_INCLUDED #include "my_base.h" #include #include "queues.h" #include class Sort_param; /** A priority queue with a fixed, limited size. This is a wrapper on top of QUEUE and the queue_xxx() functions. It keeps the top-N elements which are inserted. Elements of type Element_type are pushed into the queue. For each element, we call a user-supplied keymaker_function, to generate a key of type Key_type for the element. Instances of Key_type are compared with the user-supplied compare_function. The underlying QUEUE implementation needs one extra element for replacing the lowest/highest element when pushing into a full queue. */ template class Bounded_queue { public: Bounded_queue() { memset(&m_queue, 0, sizeof(m_queue)); } ~Bounded_queue() { delete_queue(&m_queue); } /** Function for making sort-key from input data. @param param Sort parameters. @param to Where to put the key. @param from The input data. */ typedef uint (*keymaker_function)(Sort_param *param, Key_type *to, Element_type *from, bool packing_keys); /** Initialize the queue. @param max_elements The size of the queue. @param max_at_top Set to true if you want biggest element on top. false: We keep the n largest elements. pop() will return the smallest key in the result set. true: We keep the n smallest elements. pop() will return the largest key in the result set. @param compare_length Length of the data (i.e. the keys) used for sorting. @param keymaker Function which generates keys for elements. @param sort_param Sort parameters. @param sort_keys Array of pointers to keys to sort. @retval 0 OK, 1 Could not allocate memory. We do *not* take ownership of any of the input pointer arguments. */ int init(ha_rows max_elements, bool max_at_top, size_t compare_length, keymaker_function keymaker, Sort_param *sort_param, Key_type **sort_keys); /** Pushes an element on the queue. If the queue is already full, we discard one element. Calls keymaker_function to generate a key for the element. @param element The element to be pushed. */ void push(Element_type *element); /** Removes the top element from the queue. @retval Pointer to the (key of the) removed element. @note This function is for unit testing, where we push elements into to the queue, and test that the appropriate keys are retained. Interleaving of push() and pop() operations has not been tested. */ Key_type **pop() { // Don't return the extra element to the client code. if (queue_is_full((&m_queue))) queue_remove(&m_queue, 0); DBUG_ASSERT(m_queue.elements > 0); if (m_queue.elements == 0) return NULL; return reinterpret_cast(queue_remove(&m_queue, 0)); } /** The number of elements in the queue. */ uint num_elements() const { return m_queue.elements; } /** Is the queue initialized? */ bool is_initialized() const { return m_queue.max_elements > 0; } private: Key_type **m_sort_keys; size_t m_compare_length; keymaker_function m_keymaker; Sort_param *m_sort_param; st_queue m_queue; }; template int Bounded_queue::init(ha_rows max_elements, bool max_at_top, size_t compare_length, keymaker_function keymaker, Sort_param *sort_param, Key_type **sort_keys) { DBUG_ASSERT(sort_keys != NULL); m_sort_keys= sort_keys; m_compare_length= compare_length; m_keymaker= keymaker; m_sort_param= sort_param; // init_queue() takes an uint, and also does (max_elements + 1) if (max_elements >= (UINT_MAX - 1)) return 1; // We allocate space for one extra element, for replace when queue is full. return init_queue(&m_queue, (uint) max_elements + 1, 0, max_at_top, get_ptr_compare(compare_length), &m_compare_length, 0, 0); } template void Bounded_queue::push(Element_type *element) { DBUG_ASSERT(is_initialized()); if (queue_is_full((&m_queue))) { // Replace top element with new key, and re-order the queue. Key_type **pq_top= reinterpret_cast(queue_top(&m_queue)); (void)(*m_keymaker)(m_sort_param, *pq_top, element, false); queue_replace_top(&m_queue); } else { // Insert new key into the queue. (*m_keymaker)(m_sort_param, m_sort_keys[m_queue.elements], element, false); queue_insert(&m_queue, reinterpret_cast(&m_sort_keys[m_queue.elements])); } } #endif // BOUNDED_QUEUE_INCLUDED