eventlp

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventLoop

type EventLoop struct {
	// contains filtered or unexported fields
}

EventLoop is a simple event loop that supports concurrent processing. Tasks are processed in the order they're received on the queue. Some tasks may require less time to process.

func New

func New() *EventLoop

New constructs an event loop.

func (*EventLoop) GracefullyStop

func (p *EventLoop) GracefullyStop() error

GracefullyStop waits for the event loop to drain before returning.

func (*EventLoop) Once

func (p *EventLoop) Once(ctx context.Context)

Once is used to execute a single run of the event loop.

func (*EventLoop) Start

func (p *EventLoop) Start(parent context.Context) error

Start runs the event loop.

func (*EventLoop) Stop

func (p *EventLoop) Stop() error

Stop shuts down the server and doesn't wait before returning.

func (*EventLoop) Submit

func (p *EventLoop) Submit(task Task) error

Submit adds an item to the end of the queue

func (*EventLoop) WithClock

func (p *EventLoop) WithClock(clock clockwork.Clock) *EventLoop

Clock overrides the clock used for the event loop.

type LinkedList

type LinkedList struct {
	// contains filtered or unexported fields
}

LinkedList implements a doubly linked list making it easy to treat as a stack or as a queue. This shares a similar interface to c++'s vector object.

func (*LinkedList) PopBack

func (ll *LinkedList) PopBack() T

PopBack removes the element at the end of the list.

func (*LinkedList) PopFront

func (ll *LinkedList) PopFront() T

PopFront removes the element from the start of the list.

func (*LinkedList) PushBack

func (ll *LinkedList) PushBack(t T)

PushBack appends an element to the end of the list.

func (*LinkedList) PushFront

func (ll *LinkedList) PushFront(t T)

PushFront prepends an element to the start of the list.

func (*LinkedList) Size

func (ll *LinkedList) Size() int

type T

type T interface{}

T is a definition for a generic value stored in the linked list

type Task

type Task func(ctx context.Context)

Task represents a unit of work

Jump to

Keyboard shortcuts

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