goqueue

package module
v0.0.0-...-a952043 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 3 Imported by: 0

README

goqueue

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorQueueFull  = errors.New("queue was full")
	ErrorQueueEmpty = errors.New("queue was empty")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	PushBlocking bool
	PopBlocking  bool
	MaxBuffer    int64
}

type InMemoryQueue

type InMemoryQueue struct {
	Config
	// contains filtered or unexported fields
}

func NewInMemoryQueue

func NewInMemoryQueue(config Config) *InMemoryQueue

func (*InMemoryQueue) BlockingPop

func (i *InMemoryQueue) BlockingPop(ctx context.Context) (Task, error)

func (*InMemoryQueue) BlockingPush

func (i *InMemoryQueue) BlockingPush(ctx context.Context, task Task) error

func (*InMemoryQueue) NonBlockingPop

func (i *InMemoryQueue) NonBlockingPop(ctx context.Context) (Task, error)

func (*InMemoryQueue) NonBlockingPush

func (i *InMemoryQueue) NonBlockingPush(ctx context.Context, task Task) error

func (*InMemoryQueue) Pop

func (i *InMemoryQueue) Pop(ctx context.Context) (Task, error)

func (*InMemoryQueue) Push

func (i *InMemoryQueue) Push(ctx context.Context, task Task) error

type Queue

type Queue interface {
	Push(ctx context.Context, task Task) error
	Pop(ctx context.Context) (Task, error)
}

type Task

type Task interface {
	Execute(ctx context.Context) error
}

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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