Documentation ¶
Index ¶
- Constants
- func NoPriority[E any](E) bool
- type Factory
- type Hashable
- type InfinitePipe
- type IntConvertable
- type LimitedPriorityHashQueue
- type Pipe
- func NewHashInfinitePipe[E Hashable]() Pipe[E]
- func NewInfinitePipe[E any]() Pipe[E]
- func NewLimitHashInfinitePipe[E Hashable](limit int) Pipe[E]
- func NewLimitInfinitePipe[E any](limit int) Pipe[E]
- func NewLimitPriorityHashInfinitePipe[E Hashable](priorityFun func(E) bool, limit int) Pipe[E]
- func NewLimitPriorityInfinitePipe[E any](priorityFun func(E) bool, limit int) Pipe[E]
- func NewPriorityHashInfinitePipe[E Hashable](priorityFun func(E) bool) Pipe[E]
- func NewPriorityInfinitePipe[E any](priorityFun func(E) bool) Pipe[E]
- type Queue
- func NewHashLimitedPriorityHashQueue[E Hashable]() Queue[E]
- func NewLimitHashLimitedPriorityHashQueue[E Hashable](limit int) Queue[E]
- func NewLimitLimitedPriorityHashQueue[E any](limit int) Queue[E]
- func NewLimitPriorityHashLimitedPriorityHashQueue[E Hashable](priorityFun func(E) bool, limit int) Queue[E]
- func NewLimitPriorityLimitedPriorityHashQueue[E any](priorityFun func(E) bool, limit int) Queue[E]
- func NewLimitedPriorityHashQueue[E any]() Queue[E]
- func NewPriorityHashLimitedPriorityHashQueue[E Hashable](priorityFun func(E) bool) Queue[E]
- func NewPriorityLimitedPriorityHashQueue[E any](priorityFun func(E) bool) Queue[E]
- type SimpleHashable
- type SimpleHashableFactory
- type SimpleNothashable
- type SimpleNothashableFactory
Constants ¶
const Infinity = 0
Variables ¶
This section is empty.
Functions ¶
func NoPriority ¶ added in v1.0.3
Types ¶
type Factory ¶ added in v1.0.3
type Factory[E IntConvertable] interface { Create(int) E }
func NewSimpleHashableFactory ¶ added in v1.0.3
func NewSimpleHashableFactory() Factory[SimpleHashable]
func NewSimpleNothashableFactory ¶ added in v1.0.3
func NewSimpleNothashableFactory() Factory[SimpleNothashable]
type InfinitePipe ¶
type InfinitePipe[E any] struct { // contains filtered or unexported fields }
InfinitePipe provides deserialised sender and receiver: it queues messages sent by the sender and returns them to the receiver whenever it is ready, without blocking the sender process. Depending on the backing queue, the pipe might have other characteristics.
func (*InfinitePipe[E]) Close ¶
func (ch *InfinitePipe[E]) Close()
func (*InfinitePipe[E]) In ¶
func (ch *InfinitePipe[E]) In() chan<- E
func (*InfinitePipe[E]) Len ¶
func (ch *InfinitePipe[E]) Len() int
func (*InfinitePipe[E]) Out ¶
func (ch *InfinitePipe[E]) Out() <-chan E
type IntConvertable ¶
type IntConvertable interface {
AsInt() int
}
type LimitedPriorityHashQueue ¶
type LimitedPriorityHashQueue[E any] struct { // contains filtered or unexported fields }
LimitedPriorityHashQueue is a queue, which can prioritize elements, limit its growth and reject already included elements.
func (*LimitedPriorityHashQueue[E]) Add ¶
func (q *LimitedPriorityHashQueue[E]) Add(elem E) bool
func (*LimitedPriorityHashQueue[E]) Get ¶
func (q *LimitedPriorityHashQueue[E]) Get(i int) E
Get returns the element at index i in the queue. If the index is invalid, the call will panic. This method accepts both positive and negative index values. Index 0 refers to the first element, and index -1 refers to the last.
func (*LimitedPriorityHashQueue[E]) Length ¶
func (q *LimitedPriorityHashQueue[E]) Length() int
Length returns the number of elements currently stored in the queue.
func (*LimitedPriorityHashQueue[E]) Peek ¶
func (q *LimitedPriorityHashQueue[E]) Peek() E
Peek returns the element at the head of the queue. This call panics if the queue is empty.
func (*LimitedPriorityHashQueue[E]) Remove ¶
func (q *LimitedPriorityHashQueue[E]) Remove() E
Remove removes and returns the element from the front of the queue. If the queue is empty, the call will panic.
type Pipe ¶
func NewHashInfinitePipe ¶
func NewInfinitePipe ¶
func NewLimitInfinitePipe ¶
func NewLimitPriorityHashInfinitePipe ¶ added in v1.0.3
func NewPriorityInfinitePipe ¶
type Queue ¶
func NewLimitPriorityHashLimitedPriorityHashQueue ¶ added in v1.0.3
type SimpleHashable ¶
type SimpleHashable int
func (SimpleHashable) AsInt ¶ added in v1.0.3
func (sh SimpleHashable) AsInt() int
func (SimpleHashable) GetHash ¶
func (sh SimpleHashable) GetHash() hashing.HashValue
type SimpleHashableFactory ¶ added in v1.0.3
type SimpleHashableFactory struct{}
func (*SimpleHashableFactory) Create ¶ added in v1.0.3
func (*SimpleHashableFactory) Create(i int) SimpleHashable
type SimpleNothashable ¶ added in v1.0.3
type SimpleNothashable int
func (SimpleNothashable) AsInt ¶ added in v1.0.3
func (snh SimpleNothashable) AsInt() int
type SimpleNothashableFactory ¶ added in v1.0.3
type SimpleNothashableFactory struct{}
func (*SimpleNothashableFactory) Create ¶ added in v1.0.3
func (*SimpleNothashableFactory) Create(i int) SimpleNothashable