core/connmgr/decay library
Classes
- Decayer
- Decayer is implemented by connection managers supporting decaying tags.
- DecayingTag
- Represents a decaying tag. The tag is a long-lived general object, used to operate on tag values for peers.
- DecayingValue
- A decaying tag is one whose value automatically decays over time.
Functions
-
bumpOverwrite(
) → BumpFn - Replaces the current value of the tag with the incoming one.
-
bumpSumBounded(
int min, int max) → BumpFn -
Keeps summing the incoming score, keeping it within a
min, max
range. -
bumpSumUnbounded(
) → BumpFn - Common bump functions Adds the incoming value to the peer's score.
-
decayExpireWhenInactive(
Duration after) → DecayFn - Expires a tag after a certain period of no bumps.
-
decayFixed(
int minuend) → DecayFn - Subtracts from by the provided minuend, and deletes the tag when first reaching 0 or negative.
-
decayLinear(
double coef) → DecayFn - Applies a fractional coefficient to the value of the current tag, rounding down. It erases the tag when the result is zero.
-
decayNone(
) → DecayFn - Common decay functions Applies no decay.
Typedefs
- BumpFn = int Function(DecayingValue value, int delta)
- BumpFn applies a delta onto an existing score, and returns the new score.
- DecayFn = (int, bool) Function(DecayingValue value)
- DecayFn applies a decay to the peer's score. The implementation must call DecayFn at the interval supplied when registering the tag.