blero

package
v0.0.0-...-da200cc Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blero

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

Blero struct

func New

func New(dbPath string) *Blero

New creates new Blero Backend

func (*Blero) EnqueueJob

func (bl *Blero) EnqueueJob(name string, data []byte) (uint64, error)

EnqueueJob enqueues a new Job and returns the job id

func (*Blero) RegisterProcessor

func (bl *Blero) RegisterProcessor(p Processor) int

RegisterProcessor registers a new processor and returns the processor id

func (*Blero) RegisterProcessorFunc

func (bl *Blero) RegisterProcessorFunc(f func(j *Job) error) int

RegisterProcessorFunc registers a new ProcessorFunc and returns the processor id

func (*Blero) Start

func (bl *Blero) Start(db *badger.DB) error

Start Blero

func (*Blero) Stop

func (bl *Blero) Stop() error

Stop Blero and Release resources

func (*Blero) UnregisterProcessor

func (bl *Blero) UnregisterProcessor(pID int)

UnregisterProcessor unregisters a processor No more jobs will be assigned but if will not cancel a job that already started processing

type Job

type Job struct {
	ID   uint64
	Name string
	Data []byte
}

Job represents a Goblero job definition

type Processor

type Processor interface {
	Run(j *Job) error
}

Processor interface

type ProcessorFunc

type ProcessorFunc func(j *Job) error

ProcessorFunc is a processor function

func (ProcessorFunc) Run

func (pf ProcessorFunc) Run(j *Job) error

Run allows using ProcessorFunc as a Processor

Jump to

Keyboard shortcuts

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