Documentation
¶
Index ¶
Constants ¶
View Source
const SIZE int = 2 ^ 20
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, v T) bool
func MkThrottler ¶
func MkThrottler(timeout int64) *ipThrottle
Returns a throttler that can memorize up to 2^20 IP addresses. Can be queried to check if an IP address was stored within the timeout window. If size is exceeded, the odlest IP address that was stored will be discarded first.
Types ¶
type Elem ¶
type Elem[T comparable] interface { ToComparable() T }
type Promise ¶
type Promise[T any] interface { // Fullfil the promise. [Get] will unblock (when called already) or succeed // (when called later). Fulfill(T) // Cancel a promise. Subsequent calls to [Get] will return T's null value. Reject() // Return the value of the promise. Will only return the result the promise // was fullfilled with exactly once. Afterwards, it will return the null // value. Call will block on unfullfilled promise. Get() T }
An interface to implement promises that can be created and fullfilled later.
func Fullfilled ¶
Return a promise that is already fullfilled with the given value.
Click to show internal directories.
Click to hide internal directories.