Source
zbx_hashset_create_ext(&manager->rule_index, 0, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC,
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** 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; either version 2 of the License, or
** (at your option) any later version.
**
** 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-1301, USA.
**/
extern ZBX_THREAD_LOCAL unsigned char process_type;
extern unsigned char program_type;
extern ZBX_THREAD_LOCAL int server_num, process_num;
extern int CONFIG_LLDWORKER_FORKS;
/*
* The LLD queue is organized as a queue (rule_queue binary heap) of LLD rules,
* sorted by their oldest value timestamps. The values are stored in linked lists,
* each rule having its own list of values. Values inside list are not sorted, so
* in the case a LLD rule received a value with past timestamp, it will be processed
* in queuing order, not the value chronological order.
*
* During processing the rule with oldest value is popped from queue and sent
* to a free worker. After processing the rule worker sends done response and
* manager removes the oldest value from rule's value list. If there are no more
* values in the list the rule is removed from the index (rule_index hashset),
* otherwise the rule is enqueued back in LLD queue.
*
*/
typedef struct
{
/* workers vector, created during manager initialization */
zbx_vector_ptr_t workers;
/* free workers */
zbx_queue_ptr_t free_workers;
/* workers indexed by IPC service clients */
zbx_hashset_t workers_client;
/* the next worker index to be assigned to new IPC service clients */
int next_worker_index;
/* index of queued LLD rules */