Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LowestMultipleOfTwo ¶
return the lowest multiple of backSize as a multiple of two which would be equal or greater than n.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter() *Counter
func (*Counter) Get ¶
Get returns the value of the current-P shard only, without merging contributions from other shards.
type List ¶
type List[T any] struct { // contains filtered or unexported fields }
List represents a doubly linked list. The zero value for List is an empty list ready to use.
func (*List[T]) Back ¶
func (l *List[T]) Back() *element[T]
Back returns the last element of list l or nil if the list is empty.
type Merger ¶
type Merger[T any] interface { // Called by Sharded to reduce the number of shards in the pool. Merge(other T) T }
Merger interface for the merge function.
type Sharded ¶
type Sharded[T Merger[T]] struct { NewShard func() T // contains filtered or unexported fields }
Sharded is a pool of values that are optimistically processor-local.
The zero value is ready to use. If NewShard is nil, new shards will start with the zero value of T.
func NewSharded ¶
func (*Sharded) Lock ¶
func (*Sharded) Lock()
Lock is a no-op used by -copylocks checker from `go vet`.
func (*Sharded[T]) UpdateEach ¶
func (s *Sharded[T]) UpdateEach(fn func(T) T)
Click to show internal directories.
Click to hide internal directories.