gearman-go/worker/common.go

52 lines
950 B
Go
Raw Normal View History

2013-08-30 12:36:57 +08:00
package worker
const (
Network = "tcp"
2013-08-30 12:36:57 +08:00
// queue size
queueSize = 8
2013-08-30 12:36:57 +08:00
// read buffer size
bufferSize = 1024
2013-08-30 12:36:57 +08:00
// min packet length
minPacketLength = 12
2013-08-30 12:36:57 +08:00
// \x00REQ
2013-12-26 15:55:16 +08:00
req = 5391697
reqStr = "\x00REQ"
2013-08-30 12:36:57 +08:00
// \x00RES
2013-12-26 15:55:16 +08:00
res = 5391699
resStr = "\x00RES"
2013-08-30 12:36:57 +08:00
// package data type
dtCanDo = 1
dtCantDo = 2
dtResetAbilities = 3
dtPreSleep = 4
2013-12-26 15:55:16 +08:00
dtNoop = 6
dtJobCreated = 8
dtGrabJob = 9
dtNoJob = 10
dtJobAssign = 11
dtWorkStatus = 12
dtWorkComplete = 13
dtWorkFail = 14
dtGetStatus = 15
dtEchoReq = 16
dtEchoRes = 17
2013-12-26 15:55:16 +08:00
dtError = 19
dtStatusRes = 20
2013-12-26 15:55:16 +08:00
dtSetClientId = 22
dtCanDoTimeout = 23
dtAllYours = 24
dtWorkException = 25
dtWorkData = 28
dtWorkWarning = 29
2013-12-26 15:55:16 +08:00
dtGrabJobUniq = 30
dtJobAssignUniq = 31
2013-08-30 12:36:57 +08:00
)
2013-08-30 18:01:10 +08:00
func getBuffer(l int) (buf []byte) {
// TODO add byte buffer pool
buf = make([]byte, l)
return
}