fake

package
v0.6.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

type Cleaner struct {
	RunBehavior RunFunction
}

Cleaner is a fake implementation of async.Cleaner used for testing

func NewCleaner

func NewCleaner() *Cleaner

NewCleaner returns a new, fake implementation of async.Cleaner used for testing

func (*Cleaner) Clean

func (c *Cleaner) Clean(ctx context.Context) error

Clean causes the cleaner to begin cleaning up after dead workers

type Engine

type Engine struct {
	SubmittedTasks map[string]model.Task
	RunBehavior    RunFunction
}

Engine is a fake implementation of async.Engine used for testing

func NewEngine

func NewEngine() *Engine

NewEngine returns a new, fake implementation of async.Engine used for testing

func (*Engine) RegisterJob

func (e *Engine) RegisterJob(name string, fn model.JobFunction) error

RegisterJob registers a new Job with the async engine

func (*Engine) Start

func (e *Engine) Start(ctx context.Context) error

Start causes the async engine to begin executing queued tasks

func (*Engine) SubmitTask

func (e *Engine) SubmitTask(task model.Task) error

SubmitTask submits an idempotent task to the async engine for reliable, asynchronous completion

type Heart

type Heart struct {
	RunBehavior RunFunction
}

Heart is a fake implementation of async.Heart used for testing

func NewHeart

func NewHeart() *Heart

NewHeart returns a new, fake implementation of async.Heart used for testing

func (*Heart) Beat

func (*Heart) Beat() error

Beat sends a single heartbeat

func (*Heart) Start

func (h *Heart) Start(ctx context.Context) error

Start sends heartbeats at regular intervals

type RunFunction

type RunFunction func(context.Context) error

RunFunction describes a function used to provide pluggable runtime behavior to various fake implementations of interfaces from the async package

type Worker

type Worker struct {
	RunBehavior RunFunction
}

Worker is a fake implementation of async.Worker used for testing

func NewWorker

func NewWorker() *Worker

NewWorker returns a new, fake implementation of async.Worker used for testing

func (*Worker) GetID

func (w *Worker) GetID() string

GetID returns the worker's ID

func (*Worker) RegisterJob

func (w *Worker) RegisterJob(name string, fn model.JobFunction) error

RegisterJob registers a new Job with the worker

func (*Worker) Work

func (w *Worker) Work(ctx context.Context) error

Work causes the worker to begin processing tags

Jump to

Keyboard shortcuts

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