Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List tracks elements along with their creation times. This is essentially a linked list with timestamp on each entry, allowing dropping old entries. This struct is not thread safe. TODO(x13n): Migrate to generics once supported by Go stdlib (container/list in particular).
func (*List) DropNotNewerThan ¶
DropNotNewerThan removes all elements of the list that are older or exactly as old as the provided time.
func (*List) RegisterElement ¶
func (e *List) RegisterElement(elem interface{})
RegisterElement adds new element to the list.
func (*List) ToSlice ¶
func (e *List) ToSlice() []interface{}
ToSlice converts the underlying list of elements into a slice.
func (*List) ToSliceWithTimestamp ¶
ToSliceWithTimestamp is identical to ToSlice, but additionally returns the timestamp of newest entry (or current time if there are no entries).