Documentation
¶
Index ¶
- type Queue
- func (s *Queue) Clear()
- func (s *Queue) Close() error
- func (s *Queue) Has(check func(elem interface{}) bool) bool
- func (s *Queue) Len() int
- func (s *Queue) Next() bool
- func (s *Queue) Pop() (interface{}, bool)
- func (s *Queue) PopBlocking() (interface{}, bool)
- func (s *Queue) Push(n interface{}) error
- func (s *Queue) PushUnique(n interface{}, existFunc func(elem interface{}) bool) (bool, error)
- func (s *Queue) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a basic FIFO queue.
func (*Queue) Close ¶
Close closes the queue. Use this to release all PopBlocking calls. The queue will be emptied before PopBlocking returns false.
func (*Queue) Has ¶ added in v0.1.5
Has checks if an item in the list exists according to the given check function. This is not blocking. When it is done the element you are looking for could have been added.
func (*Queue) Next ¶ added in v0.1.1
Next blocks until an element is available or the queue is closed. Reports false if the queue has been emptied and is closed. Beware that if multiple goroutines read from the queue, Pop can return false after Next was true.
func (*Queue) Pop ¶
Pop removes and returns a node from the queue. The bool value is false if the queue was empty.
func (*Queue) PopBlocking ¶
PopBlocking removes and returns a node from the queue. It blocks until an element is available or the queue is closed. The bool value is false if the queue has been emptied and was closed.
func (*Queue) PushUnique ¶ added in v0.1.5
PushUnique adds a node to the queue if it does not exist already. The existence is checked with existFunc. Will fail if the queue has been closed.