listop

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexedList

type IndexedList[T element.Indexable] struct {
	// contains filtered or unexported fields
}

func NewIndexedList

func NewIndexedList[T element.Indexable]() IndexedList[T]

func (*IndexedList[T]) Get

func (l *IndexedList[T]) Get(index string) *T

func (*IndexedList[T]) Gets

func (l *IndexedList[T]) Gets(indexes []string) map[string]T

func (*IndexedList[T]) HalveReadCounts added in v0.9.0

func (l *IndexedList[T]) HalveReadCounts()

func (*IndexedList[T]) Len

func (l *IndexedList[T]) Len() int

func (*IndexedList[T]) OrderedReadWriteCounts

func (l *IndexedList[T]) OrderedReadWriteCounts() []uint32

returns read write counts in order that they appear in the current buffer's list

func (*IndexedList[T]) Pop

func (l *IndexedList[T]) Pop(amount int) []T

func (*IndexedList[T]) PopWhere

func (l *IndexedList[T]) PopWhere(predicate func(T) bool, amount int) []T

func (*IndexedList[T]) ReadWriteCounts

func (l *IndexedList[T]) ReadWriteCounts(indexes []string) map[string]uint32

returns the read write count for the given indexes; does not affect the count

func (*IndexedList[T]) Remove

func (l *IndexedList[T]) Remove(indexes []string)

func (*IndexedList[T]) Set

func (l *IndexedList[T]) Set(values []T)

func (*IndexedList[T]) SortByReadCount

func (l *IndexedList[T]) SortByReadCount()

Insertion sort from the least read to the most read

type LRMap added in v0.9.0

type LRMap[T element.Indexable] struct {
	// contains filtered or unexported fields
}

LRMap is a left-right concurrent map. Readers are lock-free (RLock). Writers are serialized by a mutex.

func NewLRMap added in v0.9.0

func NewLRMap[T element.Indexable]() *LRMap[T]

func (*LRMap[T]) Get added in v0.9.0

func (lr *LRMap[T]) Get(key string) (T, bool)

Get returns a copy of the value for the given key. Safe from any goroutine.

func (*LRMap[T]) Gets added in v0.9.0

func (lr *LRMap[T]) Gets(keys []string) map[string]T

Gets returns values for the given keys. Safe from any goroutine.

func (*LRMap[T]) Len added in v0.9.0

func (lr *LRMap[T]) Len() int

Len returns the number of items. Safe from any goroutine.

func (*LRMap[T]) Remove added in v0.9.0

func (lr *LRMap[T]) Remove(keys []string)

Remove deletes keys.

func (*LRMap[T]) Set added in v0.9.0

func (lr *LRMap[T]) Set(items []T)

Set inserts or updates items.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL