gearman-go/client/common.go

72 lines
1.3 KiB
Go
Raw Normal View History

2013-08-29 16:51:23 +08:00
package client
const (
Network = "tcp"
2013-08-29 16:51:23 +08:00
// queue size
queueSize = 8
2013-08-29 16:51:23 +08:00
// read buffer size
bufferSize = 1024
2013-08-29 16:51:23 +08:00
// min packet length
minPacketLength = 12
2013-08-29 16:51:23 +08:00
// \x00REQ
req = 5391697
reqStr = "\x00REQ"
2013-08-29 16:51:23 +08:00
// \x00RES
res = 5391699
resStr = "\x00RES"
2013-08-29 16:51:23 +08:00
// package data type
dtCanDo = 1
dtCantDo = 2
dtResetAbilities = 3
dtPreSleep = 4
dtNoop = 6
dtJobCreated = 8
dtGrabJob = 9
dtNoJob = 10
dtJobAssign = 11
dtWorkStatus = 12
dtWorkComplete = 13
dtWorkFail = 14
dtGetStatus = 15
dtEchoReq = 16
dtEchoRes = 17
dtError = 19
dtStatusRes = 20
dtSetClientId = 22
dtCanDoTimeout = 23
dtAllYours = 24
dtWorkException = 25
dtWorkData = 28
dtWorkWarning = 29
dtGrabJobUniq = 30
dtJobAssignUniq = 31
2013-08-29 16:51:23 +08:00
dtSubmitJob = 7
dtSubmitJobBg = 18
dtSubmitJobHigh = 21
dtSubmitJobHighBg = 32
dtSubmitJobLow = 33
dtSubmitJobLowBg = 34
2013-08-29 16:51:23 +08:00
)
const (
// Job type
// JOB_NORMAL | JOB_BG means a normal level job run in background
// normal level
JobNormal = 0
2013-08-29 16:51:23 +08:00
// background job
JobBg = 1
2013-08-29 16:51:23 +08:00
// low level
JobLow = 2
2013-08-29 16:51:23 +08:00
// high level
JobHigh = 4
2013-08-29 16:51:23 +08:00
)
func getBuffer(l int) (buf []byte) {
// TODO add byte buffer pool
buf = make([]byte, l)
return
}