Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayDelayQueue ¶
type ArrayDelayQueue[E comparable] struct { // contains filtered or unexported fields }
func (*ArrayDelayQueue[E]) Len ¶
func (dq *ArrayDelayQueue[E]) Len() int64
func (*ArrayDelayQueue[E]) Offer ¶
func (dq *ArrayDelayQueue[E]) Offer(item E, expiration int64)
func (*ArrayDelayQueue[E]) PollToChan ¶
func (dq *ArrayDelayQueue[E]) PollToChan(nowFn func() int64, C infra.SendOnlyChannel[E])
type ArrayPriorityQueue ¶
type ArrayPriorityQueue[E comparable] struct { // contains filtered or unexported fields }
func (*ArrayPriorityQueue[E]) Len ¶
func (pq *ArrayPriorityQueue[E]) Len() int64
func (*ArrayPriorityQueue[E]) Peek ¶
func (pq *ArrayPriorityQueue[E]) Peek() ReadOnlyPQItem[E]
func (*ArrayPriorityQueue[E]) Pop ¶
func (pq *ArrayPriorityQueue[E]) Pop() (nilItem ReadOnlyPQItem[E])
func (*ArrayPriorityQueue[E]) Push ¶
func (pq *ArrayPriorityQueue[E]) Push(item PQItem[E])
type ArrayPriorityQueueOption ¶
type ArrayPriorityQueueOption[E comparable] func(*ArrayPriorityQueue[E])
func WithArrayPriorityQueueCapacity ¶
func WithArrayPriorityQueueCapacity[E comparable](capacity int) ArrayPriorityQueueOption[E]
func WithArrayPriorityQueueComparator ¶
func WithArrayPriorityQueueComparator[E comparable](fn PQItemLessThenComparator[E]) ArrayPriorityQueueOption[E]
func WithArrayPriorityQueueEnableThreadSafe ¶
func WithArrayPriorityQueueEnableThreadSafe[E comparable]() ArrayPriorityQueueOption[E]
type DQItem ¶
type DQItem[E comparable] interface { Expiration() int64 PQItem[E] }
func NewDelayQueueItem ¶
func NewDelayQueueItem[E comparable](val E, exp int64) DQItem[E]
type DelayQueue ¶
type DelayQueue[E comparable] interface { Offer(item E, expiration int64) // PollToChan Asynchronous function PollToChan(nowFn func() int64, C infra.SendOnlyChannel[E]) Len() int64 }
func NewArrayDelayQueue ¶
func NewArrayDelayQueue[E comparable](ctx context.Context, capacity int) DelayQueue[E]
type PQItem ¶
type PQItem[E comparable] interface { ReadOnlyPQItem[E] SetIndex(idx int64) SetPriority(pri int64) }
func NewPriorityQueueItem ¶
func NewPriorityQueueItem[E comparable](val E, pri int64) PQItem[E]
type PQItemLessThenComparator ¶
type PQItemLessThenComparator[E comparable] func(i, j ReadOnlyPQItem[E]) CmpEnum
PQItemLessThenComparator Priority queue item comparator if return 1, i > j if return 0, i == j if return -1, i < j
type PriorityQueue ¶
type PriorityQueue[E comparable] interface { Len() int64 Push(item PQItem[E]) Pop() ReadOnlyPQItem[E] Peek() ReadOnlyPQItem[E] }
func NewArrayPriorityQueue ¶
func NewArrayPriorityQueue[E comparable](opts ...ArrayPriorityQueueOption[E]) PriorityQueue[E]
type ReadOnlyPQItem ¶
type ReadOnlyPQItem[E comparable] interface { Index() int64 Value() E Priority() int64 }
type RingBuffer ¶
type RingBuffer[T any] interface { Capacity() uint64 LoadEntryByCursor(cursor uint64) RingBufferEntry[T] }
func NewXRingBuffer ¶
func NewXRingBuffer[T any](capacity uint64) RingBuffer[T]
type RingBufferCursor ¶
type RingBufferCursor interface { Next() uint64 NextN(n uint64) uint64 Load() uint64 CompareAndSwap(old, new uint64) bool }
func NewXRingBufferCursor ¶
func NewXRingBufferCursor() RingBufferCursor
type RingBufferEntry ¶
Click to show internal directories.
Click to hide internal directories.