enhancedqueue

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnhancedQueue

type EnhancedQueue struct {
	// contains filtered or unexported fields
}

EnhancedQueue 在优先队列基础上进行了封装,功能增强

func NewEnhancedQueue

func NewEnhancedQueue(window int64) *EnhancedQueue

func (*EnhancedQueue) Add

func (eq *EnhancedQueue) Add(key string, priority int64, creationTime time.Time)

Add 将指定 key 插入 pending 队列

func (*EnhancedQueue) Export

func (eq *EnhancedQueue) Export() json.RawMessage

func (*EnhancedQueue) Import

func (eq *EnhancedQueue) Import(rawMsg json.RawMessage) error

func (*EnhancedQueue) InPending

func (eq *EnhancedQueue) InPending(key string) bool

InPending 返回指定 key 是否在等待中

func (*EnhancedQueue) InProcessing

func (eq *EnhancedQueue) InProcessing(key string) bool

InProcessing 返回指定 key 是否正在处理中

func (*EnhancedQueue) InQueue

func (eq *EnhancedQueue) InQueue(key string) bool

InQueue 返回指定 key 是否在某一具体队列中

func (*EnhancedQueue) PendingQueue

func (eq *EnhancedQueue) PendingQueue() *priorityqueue.PriorityQueue

func (*EnhancedQueue) PopPending

func (eq *EnhancedQueue) PopPending(dryRun ...bool) string

PopPending 将 pending 中的第一个 key 推进到 processing 返回被 pop 的 key

func (*EnhancedQueue) PopPendingKey

func (eq *EnhancedQueue) PopPendingKey(key string, dryRun ...bool) string

PopPendingKey pop specified key to processing queue.

func (*EnhancedQueue) PopProcessing

func (eq *EnhancedQueue) PopProcessing(key string, dryRun ...bool) string

PopProcessing 将指定 key 从 processing 队列中移除,表示完成

func (*EnhancedQueue) ProcessingQueue

func (eq *EnhancedQueue) ProcessingQueue() *priorityqueue.PriorityQueue

func (*EnhancedQueue) ProcessingWindow

func (eq *EnhancedQueue) ProcessingWindow() int64

func (*EnhancedQueue) RangePending

func (eq *EnhancedQueue) RangePending(f func(priorityqueue.Item) bool)

func (*EnhancedQueue) SetProcessingWindow

func (eq *EnhancedQueue) SetProcessingWindow(newWindow int64)

type SnapshotObj

type SnapshotObj struct {
	Pending          json.RawMessage `json:"pending"`
	Processing       json.RawMessage `json:"processing"`
	ProcessingWindow int64           `json:"processingWindow"`
}

Jump to

Keyboard shortcuts

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