queue

package
v0.0.2-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockHeightParam string = "BlockHeight"
	TimeoutParam     string = "Timeout"
)

Constants are commonly used by all the tasks through kwargs.

Variables

This section is empty.

Functions

func GetDuration

func GetDuration(key interface{}) (time.Duration, error)

GetDuration parses key parameter to time.Duration type

func ParseBlockHeight

func ParseBlockHeight(valMap map[string]interface{}) (uint64, error)

ParseBlockHeight parses blockHeight interface param to uint64

Types

type Bootstrapper

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

Bootstrapper implements bootstrap.Bootstrapper.

func (*Bootstrapper) Bootstrap

func (b *Bootstrapper) Bootstrap(context map[string]interface{}) error

Bootstrap initiates the queue.

type Config

type Config interface {

	// GetNumWorkers gets the number of background workers to initiate
	GetNumWorkers() int

	// GetWorkerWaitTime gets the worker wait time for a task to be available while polling
	// increasing this may slow down task execution while reducing it may consume a lot of CPU cycles
	GetWorkerWaitTimeMS() int
}

Config is an interface for queue specific configurations

type Server

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

Server represents the queue server currently implemented based on gocelery

func (*Server) EnqueueJob

func (qs *Server) EnqueueJob(taskTypeName string, params map[string]interface{}) (TaskResult, error)

EnqueueJob enqueues a job on the queue server for the given taskTypeName

func (*Server) Name

func (qs *Server) Name() string

Name of the queue server

func (*Server) RegisterTaskType

func (qs *Server) RegisterTaskType(name string, task interface{})

RegisterTaskType registers a task type on the queue server

func (*Server) Start

func (qs *Server) Start(ctx context.Context, wg *sync.WaitGroup, startupErr chan<- error)

Start the queue server

type TaskResult

type TaskResult interface {

	// Get the result within a timeout from the queue task execution
	Get(timeout time.Duration) (interface{}, error)
}

TaskResult represents a result from a queued task execution

type TaskType

type TaskType interface {

	// TaskTypeName of the task
	TaskTypeName() string
}

TaskType is a task to be queued in the centrifuge node to be completed asynchronously

Jump to

Keyboard shortcuts

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