Documentation ¶
Index ¶
- Constants
- func SetLogger(l *zap.SugaredLogger)
- type Item
- type Position
- type Queue
- func (q *Queue) Done(key string)
- func (q *Queue) Get(key string) (*Item, int)
- func (q *Queue) Hit(key string, value interface{})
- func (q *Queue) Hits() uint
- func (q *Queue) MinPeek(minHits uint) *Item
- func (q *Queue) MinPop(minHits uint) *Item
- func (q *Queue) Peek() *Item
- func (q *Queue) Pop() *Item
- func (q *Queue) Release(key string)
- func (q *Queue) Size() uint
Constants ¶
const ( StatusNone = iota StatusQueued // waiting to get to the top StatusActive // being processed StatusDone // done processing )
Variables ¶
This section is empty.
Functions ¶
func SetLogger ¶
func SetLogger(l *zap.SugaredLogger)
Types ¶
type Item ¶
type Item struct { Value interface{} // contains filtered or unexported fields }
Item is a queue storage unit.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue stores a priority queue with Items with most Hits being at the top.
func NewQueue ¶
func NewQueue() *Queue
NewQueue initializes an empty priority queue suitable for registering Hits right away.
func (*Queue) Hit ¶
Hit puts Item stoStatusActive at `key` higher up in the queue, or inserts it to the bottom of the pile if the item is not present.
func (*Queue) MinPeek ¶
MinPeek returns the top-most item of the queue if it has a required minimum of hits, without marking it as being processed.
func (*Queue) MinPop ¶
MinPop returns the top-most item of the queue if it has a required minimum of hits and marks it as being processed so consecutive calls will return subsequent items.
func (*Queue) Peek ¶
Peek returns the top-most item of the queue without marking it as being processed.
func (*Queue) Pop ¶
Pop returns the top-most item of the queue and marks it as being processed so consecutive calls will return subsequent items.