DroppingMessageFilter

class DroppingMessageFilter(threshold: Int = DEFAULT_MESSAGE_THRESHOLD) : MessageFilter

A dropping message filter implementation.

All incoming messages will be dropped after threshold amount of them has been received in one cycle.

threshold must be an integer between 1 and 255 (inclusive), as this data structure uses unsigned bytes to keep track of counts.

Constructors

Link copied to clipboard
constructor(threshold: Int = DEFAULT_MESSAGE_THRESHOLD)

Functions

Link copied to clipboard
open override fun accept(id: Int, size: Int): Int

Check if the message with the given id and size should be accepted. This function is responsible for incrementing any counters that are implementation-specific along-side returning the result.

Link copied to clipboard
open override fun reset()

Resets the message filter, making it ready to be used in the next cycle.