collection

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingQueue added in v0.0.2

type BlockingQueue[T any] interface {
	Push(T)
	Pop() (item T, shutdown bool)
	Size() int
	Empty() bool
	Shutdown()
	ShutdownWithDrained()
}

func NewBlockingQueue added in v0.0.2

func NewBlockingQueue[T any]() BlockingQueue[T]

func NewBlockingQueueWithConfig added in v0.0.2

func NewBlockingQueueWithConfig[T any](queue Queue[T]) BlockingQueue[T]

type ConcurrentMap

type ConcurrentMap[K comparable, V any] interface {
	Set(key K, v V)
	Get(key K) (V, bool)
	GetBatch(keys []K) []V
	Delete(key K)
	Has(key K) bool
	Keys() []K
	KeysSet() Set[K]
	Values() []V
	Merge(ConcurrentMap[K, V])
	Clone() ConcurrentMap[K, V]
	ToMap() map[K]V
	MergeMap(map[K]V)
	Len() int
}

func NewConcurrentMap

func NewConcurrentMap[K comparable, V any]() ConcurrentMap[K, V]

func NewConcurrentMapFromMap

func NewConcurrentMapFromMap[K comparable, V any](m map[K]V) ConcurrentMap[K, V]

type DelayingQueue added in v0.0.2

type DelayingQueue[T any] interface {
	BlockingQueue[T]
	PushAfter(T, time.Duration)
	Shutdown()
}

func NewDelayingQueue added in v0.0.2

func NewDelayingQueue[T any](blocking BlockingQueue[T], scheduler TimerScheduler) DelayingQueue[T]

type ExpirationMap added in v0.0.2

type ExpirationMap[K comparable, V any] interface {
	ConcurrentMap[K, V]
	SetExpired(key K, val V, duration time.Duration)
	Destroy()
}

func NewExpirationMap added in v0.0.2

func NewExpirationMap[K comparable, V any](opts ...ExpirationMapOption[K, V]) ExpirationMap[K, V]

type ExpirationMapOption added in v0.0.2

type ExpirationMapOption[K comparable, V any] func(c *expirationMap[K, V])

func WithCleanDuration added in v0.0.2

func WithCleanDuration[K comparable, V any](duration time.Duration) ExpirationMapOption[K, V]

func WithConcurrentMap added in v0.0.2

func WithConcurrentMap[K comparable, V any](cm ConcurrentMap[K, V]) ExpirationMapOption[K, V]

type PLM

type PLM[K comparable, V any] interface {
	// Pointer 获取地址
	Pointer() uintptr
	// RWLock 获取内部的RWMutex
	RWLock() *sync.RWMutex
	// InnerMap 获取内部map
	InnerMap() map[K]V
}

type Queue added in v0.0.2

type Queue[T any] interface {
	Push(T)
	Pop() T
	Peek() T
	Size() int
	Empty() bool
	Clear()
}

func NewPriorityQueue added in v0.0.2

func NewPriorityQueue[T any](less func(a, b T) bool) Queue[T]

func NewQueue added in v0.0.2

func NewQueue[T any]() Queue[T]

type Set

type Set[V comparable] interface {
	Add(v V)
	Adds(v ...V)
	AddSet(s Set[V])
	Has(v V) bool
	Delete(v V)
	Values() []V
	Any([]V) bool
	Every([]V) bool
	ForEach(func(v V))
	ForEachP(func(v *V))
	Len() int
	Iterator() iter.Seq[V]
}

func NewSet

func NewSet[V comparable]() Set[V]

func NewSetFromSlice

func NewSetFromSlice[V comparable](s []V) Set[V]

type Stack added in v0.0.2

type Stack[T any] interface {
	Queue[T]
}

type Timer added in v0.0.2

type Timer interface {
	Stop()
	Reset(duration time.Duration)
}

type TimerScheduler added in v0.0.2

type TimerScheduler interface {
	// SetTimer 设置一次性执行的定时器
	SetTimer(duration time.Duration, fn func()) Timer
	Shutdown()
	IsShutdown() bool
}

Jump to

Keyboard shortcuts

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