Source
void zbx_pb_history_write_meta_value(zbx_pb_history_data_t *data, zbx_uint64_t itemid, int state, const char *value,
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
static void pb_history_add_rows_db(zbx_list_t *rows, zbx_list_item_t *next, zbx_uint64_t *lastid);
struct zbx_pb_history_data
{
zbx_pb_state_t state;
zbx_list_t rows;
int rows_num;
zbx_db_insert_t db_insert;
zbx_uint64_t handleid;
};
void pb_list_free_history(zbx_list_t *list, zbx_pb_history_t *row)
{
if (NULL != row->value)
list->mem_free_func(row->value);
if (NULL != row->source)
list->mem_free_func(row->source);
list->mem_free_func(row);
}
/******************************************************************************
* *
* Purpose: estimate approximate history row size in cache *
* *
******************************************************************************/
size_t pb_history_estimate_row_size(const char *value, const char *source)
{
size_t size = 0;
size += zbx_shmem_required_chunk_size(sizeof(zbx_pb_history_t));
size += zbx_shmem_required_chunk_size(sizeof(zbx_list_item_t));
size += zbx_shmem_required_chunk_size(strlen(value) + 1);
size += zbx_shmem_required_chunk_size(strlen(source) + 1);
return size;