Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitSet ¶
type BitSet struct {
// contains filtered or unexported fields
}
BitSet is a set of bits.
type SlidingWindowFilter ¶
type SlidingWindowFilter struct {
// contains filtered or unexported fields
}
SlidingWindowFilter maintains a sliding window of uint64 counters.
func NewSlidingWindowFilter ¶
func NewSlidingWindowFilter(size uint64) *SlidingWindowFilter
NewSlidingWindowFilter returns a new sliding window filter with the given size.
func (*SlidingWindowFilter) Add ¶
func (f *SlidingWindowFilter) Add(counter uint64) bool
Add attempts to add counter to the sliding window and returns whether the counter is successfully added to the sliding window.
func (*SlidingWindowFilter) IsOk ¶
func (f *SlidingWindowFilter) IsOk(counter uint64) bool
IsOk checks whether counter can be accepted by the sliding window filter.
func (*SlidingWindowFilter) MustAdd ¶
func (f *SlidingWindowFilter) MustAdd(counter uint64)
MustAdd adds counter to the sliding window without checking if the counter is valid. Call IsOk beforehand to make sure the counter is valid.
func (*SlidingWindowFilter) Reset ¶
func (f *SlidingWindowFilter) Reset()
Reset resets the filter to its initial state.
func (*SlidingWindowFilter) Size ¶
func (f *SlidingWindowFilter) Size() uint64
Size returns the size of the sliding window.
Click to show internal directories.
Click to hide internal directories.