zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCconfig_items_apply_changes                                     *
 *                                                                            *
 * Purpose: apply item state, error, mtime, lastlogsize changes to            *
 *          configuration cache                                               *
 *                                                                            *
 ******************************************************************************/
DCconfig_items_apply_changes

Purpose: apply item state, error, mtime, lastlogsize changes to
configuration cache
DCconfig_items_apply_changes Purpose : apply item state error mtime lastlogsize changes to configuration cache
void	DCconfig_items_apply_changes(const zbx_vector_ptr_t *item_diff)
{
	int			i;
	const zbx_item_diff_t	*diff;
	ZBX_DC_ITEM		*dc_item;
	if (0 == item_diff->values_num)
		return;
	WRLOCK_CACHE;
	for (i = 0; i < item_diff->values_num; i++)
	{
		diff = (const zbx_item_diff_t *)item_diff->values[i];
		if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &diff->itemid)))
			continue;
		if (0 != (ZBX_FLAGS_ITEM_DIFF_UPDATE_LASTLOGSIZE & diff->flags))
			dc_item->lastlogsize = diff->lastlogsize;
		if (0 != (ZBX_FLAGS_ITEM_DIFF_UPDATE_MTIME & diff->flags))
			dc_item->mtime = diff->mtime;
		if (0 != (ZBX_FLAGS_ITEM_DIFF_UPDATE_ERROR & diff->flags))
			DCstrpool_replace(1, &dc_item->error, diff->error);
		if (0 != (ZBX_FLAGS_ITEM_DIFF_UPDATE_STATE & diff->flags))
			dc_item->state = diff->state;
	}
	UNLOCK_CACHE;
}
void DCconfig_items_apply_changes ( const zbx_vector_ptr_t * item_diff ) { int i ; const zbx_item_diff_t * diff ; ZBX_DC_ITEM * dc_item ; if ( 0 == item_diff -> values_num ) return ; WRLOCK_CACHE ; for ( i = 0 ; i < item_diff -> values_num ; i ++ ) { diff = ( const zbx_item_diff_t * ) item_diff -> values [ i ] ; if ( NULL == ( dc_item = ( ZBX_DC_ITEM * ) zbx_hashset_search ( & config -> items , & diff -> itemid ) ) ) continue ; if ( 0 != ( ZBX_FLAGS_ITEM_DIFF_UPDATE_LASTLOGSIZE & diff -> flags ) ) dc_item -> lastlogsize = diff -> lastlogsize ; if ( 0 != ( ZBX_FLAGS_ITEM_DIFF_UPDATE_MTIME & diff -> flags ) ) dc_item -> mtime = diff -> mtime ; if ( 0 != ( ZBX_FLAGS_ITEM_DIFF_UPDATE_ERROR & diff -> flags ) ) DCstrpool_replace ( 1 , & dc_item -> error , diff -> error ) ; if ( 0 != ( ZBX_FLAGS_ITEM_DIFF_UPDATE_STATE & diff -> flags ) ) dc_item -> state = diff -> state ; } UNLOCK_CACHE ; }
Function: DCconfig_items_apply_changes                                     
                                                                            
 Purpose: apply item state, error, mtime, lastlogsize changes to            
          configuration cache
Function : DCconfig_items_apply_changes Purpose : apply item state error mtime lastlogsize changes to configuration cache