runtime

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRIORITY_LOW  = 0
	PRIORITY_HIGH = 1

	JobPrefix       = "H:"
	CronJobPrefix   = "S:"
	EpochTimePrefix = "UTC-"
)
View Source
const (
	Network = "tcp"
	// queue size
	QueueSize = 8
	// read buffer size
	BufferSize = 1024 * 1024
	// min packet length
	MinPacketLength = 12
	HeaderSize      = 4 + 4 + 4

	// \x00REQ
	Req    = 5391697
	ReqStr = "\x00REQ"
	// \x00RES
	Res            = 5391699
	ResStr         = "\x00RES"
	DefaultTimeout = 20 // 20 Seconds

	HANDLE_SHAKE_HEADER_LENGTH = 12
)
View Source
const (
	// Job type
	JobNormal = iota
	// low level
	JobLow
	// high level
	JobHigh
)

Variables

This section is empty.

Functions

func NewBuffer

func NewBuffer(l int) (buf []byte)

Types

type CronJob

type CronJob struct {
	JobTemplete   Job       `json:"job_templete,omitempty"`
	Handle        string    `json:"cronjob_handle,omitempty"`
	CronEntryID   int       `json:"cron_entry_id"`
	Expression    string    `json:"expression,omitempty"`
	Next          time.Time `json:"next,omitempty"`
	Prev          time.Time `json:"prev,omitempty"`
	Created       int       `json:"created,omitempty"`
	SuccessfulRun int       `json:"successful_run,omitempty"`
	FailedRun     int       `json:"failed_run,omitempty"`
}

func (*CronJob) Key

func (c *CronJob) Key() string

func (*CronJob) Prefix

func (c *CronJob) Prefix() string

type CronSpecInterface

type CronSpecInterface interface {
	Bytes() []byte
	Expr() string
	Schedule() cron.Schedule
}

func NewCronSchedule

func NewCronSchedule(expr string) (CronSpecInterface, error)

type Job

type Job struct {
	Handle       string    `json:"job_handle,omitempty"` //server job handle
	Id           string    `json:"id,omitempty"`
	Data         []byte    `json:"data,omitempty"`
	Running      bool      `json:"is_running,omitempty"`
	Percent      int       `json:"percent,omitempty"`
	Denominator  int       `json:"denominator,omitempty"`
	CreateAt     time.Time `json:"created_at,omitempty"`
	ProcessAt    time.Time `json:"process_at,omitempty"`
	TimeoutSec   int32     `json:"timeout_sec,omitempty"`
	CreateBy     int64     `json:"created_by,omitempty"` //client sessionId
	ProcessBy    int64     `json:"process_by,omitempty"` //worker sessionId
	FuncName     string    `json:"function_name,omitempty"`
	IsBackGround bool      `json:"is_background_job"`
	Priority     int       `json:"priority"`
	CronHandle   string    `json:"cronjob_handle,omitempty"`
}

func (*Job) Key

func (c *Job) Key() string

func (*Job) Prefix

func (c *Job) Prefix() string

type PT

type PT uint32
const (
	PT_CanDo          PT = iota + 1 //   1            REQ    Worker
	PT_CantDo                       //   REQ    Worker
	PT_ResetAbilities               //   REQ    Worker
	PT_PreSleep                     //   REQ    Worker

	PT_Noop       //   RES    Worker
	PT_SubmitJob  //   REQ    Client
	PT_JobCreated //   RES    Client
	PT_GrabJob    //   REQ    Worker
	PT_NoJob      //   RES    Worker
	PT_JobAssign  //   RES    Worker
	PT_WorkStatus //   REQ    Worker

	//     RES    Client
	PT_WorkComplete //   REQ    Worker

	//    RES    Client
	PT_WorkFail //  REQ    Worker

	//    RES    Client
	PT_GetStatus //   REQ    Client

	PT_EchoReq       //  REQ    Client/Worker
	PT_EchoRes       //  RES    Client/Worker
	PT_SubmitJobBG   //   REQ    Client
	PT_Error         //   RES    Client/Worker
	PT_StatusRes     //   RES    Client
	PT_SubmitJobHigh //   REQ    Client
	PT_SetClientId   //  REQ    Worker
	PT_CanDoTimeout  //   REQ    Worker
	PT_AllYours      //   REQ    Worker
	PT_WorkException //   REQ    Worker

	//     RES    Client
	PT_OptionReq //   REQ    Client/Worker

	PT_OptionRes //   RES    Client/Worker
	PT_WorkData  //   REQ    Worker

	//    RES    Client
	PT_WorkWarning //  REQ    Worker

	//    RES    Client
	PT_GrabJobUniq //   REQ    Worker

	PT_JobAssignUniq   //   RES    Worker
	PT_SubmitJobHighBG //  REQ    Client
	PT_SubmitJobLow    //  REQ    Client
	PT_SubmitJobLowBG  //  REQ    Client
	PT_SubmitJobSched  //  REQ    Client
	PT_SubmitJobEpoch  //   36 REQ    Client

	// New Codes (ref: https://github.com/gearman/gearmand/commit/eabf8a01030a16c80bada1e06c4162f8d129a5e8)
	PT_SubmitReduceJob           // REQ    Client
	PT_SubmitReduceJobBackground // REQ    Client
	PT_GrabJobAll                // REQ    Worker
	PT_JobAssignAll              // RES    Worker
	PT_GetStatusUnique           // REQ    Client
	PT_StatusResUnique           // RES    Client
)

func NewPT

func NewPT(cmd uint32) (PT, error)

func (PT) ArgCount

func (i PT) ArgCount() int

func (PT) ExpectsResponse

func (i PT) ExpectsResponse() bool

func (PT) Int

func (i PT) Int() int

func (PT) String

func (i PT) String() string

func (PT) Uint32

func (i PT) Uint32() uint32

Jump to

Keyboard shortcuts

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