package connmgr

import (
	
	
)

// DecayNone applies no decay.
func () DecayFn {
	return func( DecayingValue) ( int,  bool) {
		return .Value, false
	}
}

// DecayFixed subtracts from by the provided minuend, and deletes the tag when
// first reaching 0 or negative.
func ( int) DecayFn {
	return func( DecayingValue) ( int,  bool) {
		 := .Value - 
		return ,  <= 0
	}
}

// DecayLinear applies a fractional coefficient to the value of the current tag,
// rounding down via math.Floor. It erases the tag when the result is zero.
func ( float64) DecayFn {
	return func( DecayingValue) ( int,  bool) {
		 := math.Floor(float64(.Value) * )
		return int(),  <= 0
	}
}

// DecayExpireWhenInactive expires a tag after a certain period of no bumps.
func ( time.Duration) DecayFn {
	return func( DecayingValue) ( int,  bool) {
		 = time.Until(.LastVisit) >= 
		return 0, 
	}
}

// BumpSumUnbounded adds the incoming value to the peer's score.
func () BumpFn {
	return func( DecayingValue,  int) ( int) {
		return .Value + 
	}
}

// BumpSumBounded keeps summing the incoming score, keeping it within a
// [min, max] range.
func (,  int) BumpFn {
	return func( DecayingValue,  int) ( int) {
		 := .Value + 
		if  >=  {
			return 
		} else if  <=  {
			return 
		}
		return 
	}
}

// BumpOverwrite replaces the current value of the tag with the incoming one.
func () BumpFn {
	return func( DecayingValue,  int) ( int) {
		return 
	}
}