pipe

package
v0.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const Infinity = 0

Variables

This section is empty.

Functions

func NoPriority added in v1.0.3

func NoPriority[E any](E) bool

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 Hashable

type Hashable interface {
	GetHash() hashing.HashValue
}

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

type Pipe[E any] interface {
	In() chan<- E
	Out() <-chan E
	Len() int
	Close()
}

func NewHashInfinitePipe

func NewHashInfinitePipe[E Hashable]() Pipe[E]

func NewInfinitePipe

func NewInfinitePipe[E any]() Pipe[E]

func NewLimitHashInfinitePipe

func NewLimitHashInfinitePipe[E Hashable](limit int) Pipe[E]

func NewLimitInfinitePipe

func NewLimitInfinitePipe[E any](limit int) Pipe[E]

func NewLimitPriorityHashInfinitePipe added in v1.0.3

func NewLimitPriorityHashInfinitePipe[E Hashable](priorityFun func(E) bool, limit int) Pipe[E]

func NewLimitPriorityInfinitePipe

func NewLimitPriorityInfinitePipe[E any](priorityFun func(E) bool, limit int) Pipe[E]

func NewPriorityHashInfinitePipe

func NewPriorityHashInfinitePipe[E Hashable](priorityFun func(E) bool) Pipe[E]

func NewPriorityInfinitePipe

func NewPriorityInfinitePipe[E any](priorityFun func(E) bool) Pipe[E]

type Queue

type Queue[E any] interface {
	Length() int
	Add(elem E) bool
	Peek() E
	Get(i int) E
	Remove() E
}

func NewHashLimitedPriorityHashQueue

func NewHashLimitedPriorityHashQueue[E Hashable]() Queue[E]

func NewLimitHashLimitedPriorityHashQueue

func NewLimitHashLimitedPriorityHashQueue[E Hashable](limit int) Queue[E]

func NewLimitLimitedPriorityHashQueue

func NewLimitLimitedPriorityHashQueue[E any](limit int) Queue[E]

func NewLimitPriorityHashLimitedPriorityHashQueue added in v1.0.3

func NewLimitPriorityHashLimitedPriorityHashQueue[E Hashable](priorityFun func(E) bool, limit int) Queue[E]

func NewLimitPriorityLimitedPriorityHashQueue

func NewLimitPriorityLimitedPriorityHashQueue[E any](priorityFun func(E) bool, limit int) Queue[E]

func NewLimitedPriorityHashQueue

func NewLimitedPriorityHashQueue[E any]() Queue[E]

func NewPriorityHashLimitedPriorityHashQueue

func NewPriorityHashLimitedPriorityHashQueue[E Hashable](priorityFun func(E) bool) Queue[E]

func NewPriorityLimitedPriorityHashQueue

func NewPriorityLimitedPriorityHashQueue[E any](priorityFun func(E) bool) Queue[E]

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

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

Jump to

Keyboard shortcuts

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