Documentation ¶
Index ¶
- type Item
- type PriorityQueue
- func (pq *PriorityQueue) Add(item Item)
- func (pq *PriorityQueue) Export() json.RawMessage
- func (pq *PriorityQueue) Get(key string) Item
- func (pq *PriorityQueue) Import(rawMsg json.RawMessage) error
- func (pq *PriorityQueue) LeftHasHigherOrder(left, right string) bool
- func (pq *PriorityQueue) Len() int
- func (pq *PriorityQueue) Peek() Item
- func (pq *PriorityQueue) Pop() Item
- func (pq *PriorityQueue) Range(f func(Item) (stopRange bool))
- func (pq *PriorityQueue) Remove(key string) Item
- type SnapshotObj
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item interface { Key() string Priority() int64 SetPriority(int64) CreationTime() time.Time Index() int SetIndex(int) }
Item 是优先队列存储的结构
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue 优先队列
func NewPriorityQueue ¶
func NewPriorityQueue() *PriorityQueue
func (*PriorityQueue) Export ¶
func (pq *PriorityQueue) Export() json.RawMessage
func (*PriorityQueue) Import ¶
func (pq *PriorityQueue) Import(rawMsg json.RawMessage) error
func (*PriorityQueue) LeftHasHigherOrder ¶ added in v1.0.0
func (pq *PriorityQueue) LeftHasHigherOrder(left, right string) bool
LeftHasHigherOrder judge order of two items. return true if left has higher order.
func (*PriorityQueue) Range ¶
func (pq *PriorityQueue) Range(f func(Item) (stopRange bool))
Range range items and apply func to item one by one.
Click to show internal directories.
Click to hide internal directories.