common

package
Version: v0.0.0-...-aad241e Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NETWORK = "tcp"
	// queue size
	QUEUE_SIZE = 8
	// read buffer size
	BUFFER_SIZE = 1024
	// min packet length
	PACKET_LEN = 12

	// \x00REQ
	REQ     = 5391697
	REQ_STR = "\x00REQ"
	// \x00RES
	RES     = 5391699
	RES_STR = "\x00RES"

	// package data type
	CAN_DO          = 1
	CANT_DO         = 2
	RESET_ABILITIES = 3
	PRE_SLEEP       = 4
	NOOP            = 6
	JOB_CREATED     = 8
	GRAB_JOB        = 9
	NO_JOB          = 10
	JOB_ASSIGN      = 11
	WORK_STATUS     = 12
	WORK_COMPLETE   = 13
	WORK_FAIL       = 14
	GET_STATUS      = 15
	ECHO_REQ        = 16
	ECHO_RES        = 17
	ERROR           = 19
	STATUS_RES      = 20
	SET_CLIENT_ID   = 22
	CAN_DO_TIMEOUT  = 23
	WORK_EXCEPTION  = 25
	WORK_DATA       = 28
	WORK_WARNING    = 29
	GRAB_JOB_UNIQ   = 30
	JOB_ASSIGN_UNIQ = 31

	SUBMIT_JOB         = 7
	SUBMIT_JOB_BG      = 18
	SUBMIT_JOB_HIGH    = 21
	SUBMIT_JOB_HIGH_BG = 32
	SUBMIT_JOB_LOW     = 33
	SUBMIT_JOB_LOW_BG  = 34
)

Variables

View Source
var (
	ErrJobTimeOut    = errors.New("Do a job time out")
	ErrInvalidData   = errors.New("Invalid data")
	ErrWorkWarning   = errors.New("Work warning")
	ErrWorkFail      = errors.New("Work fail")
	ErrWorkException = errors.New("Work exeption")
	ErrDataType      = errors.New("Invalid data type")
	ErrOutOfCap      = errors.New("Out of the capability")
	ErrNotConn       = errors.New("Did not connect to job server")
	ErrFuncNotFound  = errors.New("The function was not found")
	ErrConnection    = errors.New("Connection error")
	ErrNoActiveAgent = errors.New("No active agent")
	ErrTimeOut       = errors.New("Executing time out")
	ErrUnknown       = errors.New("Unknown error")
	ErrConnClosed    = errors.New("Connection closed")
)

Functions

func BytesToUint32

func BytesToUint32(buf [4]byte) uint32

Decode [4]byte to uint32

func DisablePanic

func DisablePanic()

func Errorf

func Errorf(format string, msg ...interface{}) error

Get a formated error

func GetError

func GetError(data []byte) (eno syscall.Errno, err error)

Extract the error message

func Uint32ToBytes

func Uint32ToBytes(i uint32) [4]byte

Encode uint32 to [4]byte

Types

type ErrorHandler

type ErrorHandler func(error)

An error handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL