Documentation ¶
Index ¶
- Variables
- func Compact(data Interface) int
- func NewLoggerFrom(l *log.Logger) *log.Logger
- type Interface
- type Logger
- type NopLogger
- type StdLogger
- type ThreadSafeLinkedList
- func (l *ThreadSafeLinkedList) GetAll() []interface{}
- func (l *ThreadSafeLinkedList) Iterate() func() interface{}
- func (l *ThreadSafeLinkedList) Len() int
- func (l *ThreadSafeLinkedList) Peek() interface{}
- func (l *ThreadSafeLinkedList) Pop() interface{}
- func (l *ThreadSafeLinkedList) Push(vs ...interface{})
- func (l *ThreadSafeLinkedList) RemoveFirst(pred func(interface{}) bool) bool
- func (l *ThreadSafeLinkedList) Snip(when func(interface{}) bool) int
Constants ¶
This section is empty.
Variables ¶
var B32 = b32{}
var B64 = b64{}
Functions ¶
Types ¶
type StdLogger ¶
func (*StdLogger) WithPrefix ¶
type ThreadSafeLinkedList ¶
type ThreadSafeLinkedList struct {
// contains filtered or unexported fields
}
A light-weight single linked list. Elements are added at the front, multiple additions and iterations can run concurrently and are lockfree. Removal operations are thread-safe and use a lock but run concurrently to additions and iterations. All operations must traverse the list from the front.
func (*ThreadSafeLinkedList) GetAll ¶
func (l *ThreadSafeLinkedList) GetAll() []interface{}
func (*ThreadSafeLinkedList) Iterate ¶
func (l *ThreadSafeLinkedList) Iterate() func() interface{}
func (*ThreadSafeLinkedList) Len ¶
func (l *ThreadSafeLinkedList) Len() int
func (*ThreadSafeLinkedList) Peek ¶
func (l *ThreadSafeLinkedList) Peek() interface{}
Peek returns the element at the front of the list. This is the most recently added element.
func (*ThreadSafeLinkedList) Pop ¶
func (l *ThreadSafeLinkedList) Pop() interface{}
Pop returns and removes the element at the front of the list. This is the most recently added element.
func (*ThreadSafeLinkedList) Push ¶
func (l *ThreadSafeLinkedList) Push(vs ...interface{})
Push inserts given values to the front of the list. Values are inserted in fifo order, i.e. the last value is at the front of the list, the same as if the values would be added in a loop. The values are ensured to be inserted as one sequence, uninterrupted by other concurrrent changes.
func (*ThreadSafeLinkedList) RemoveFirst ¶
func (l *ThreadSafeLinkedList) RemoveFirst(pred func(interface{}) bool) bool
func (*ThreadSafeLinkedList) Snip ¶
func (l *ThreadSafeLinkedList) Snip(when func(interface{}) bool) int
Snip removes all elements from the list after and including the element for which the provided function returns true. The function might be called multiple times for an element.