library/src/utility/BP-GenericFastWeightedBalancer.cc
// increment an index in the entry table, sets the update flag to true
increment an index in the entry table, sets the update flag to true
increment an index in the entry table sets the update flag to true
BP_ERROR_T BP_BalancerIncWeightEntryAtIndex(P_BP_WEIGHTED_BALANCER balancer , size_t index)
{
	if(!balancer)
		return ERR_FAILURE;
	if(index >= balancer->entry_n)
		return ERR_FAILURE;
	if(balancer->entries[index].overweight)
	{
		balancer->total_hits_dropped_by_this_balancer++;
		return ERR_FAILURE;
	}
	balancer->entries[index].current_hits++;
	balancer->total_hits_processed_by_this_balancer++;
	balancer->requires_update=1;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_BalancerIncWeightEntryAtIndex ( P_BP_WEIGHTED_BALANCER balancer , size_t index ) { if ( ! balancer ) return ERR_FAILURE ; if ( index >= balancer -> entry_n ) return ERR_FAILURE ; if ( balancer -> entries [ index ] . overweight ) { balancer -> total_hits_dropped_by_this_balancer ++ ; return ERR_FAILURE ; } balancer -> entries [ index ] . current_hits ++ ; balancer -> total_hits_processed_by_this_balancer ++ ; balancer -> requires_update = 1 ; return ERR_SUCCESS ; }
increment an index in the entry table, sets the update flag to true
increment an index in the entry table sets the update flag to true
// ensure we have a balancer // ensure our update index isn't greater than the index count // never process overweight entries, but mark them as dropped // increment current hits // increment the total hit count // set the update flag // return indicating success