You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
950 B

  1. package worker
  2. const (
  3. Network = "tcp"
  4. // queue size
  5. queueSize = 8
  6. // read buffer size
  7. bufferSize = 1024
  8. // min packet length
  9. minPacketLength = 12
  10. // \x00REQ
  11. req = 5391697
  12. reqStr = "\x00REQ"
  13. // \x00RES
  14. res = 5391699
  15. resStr = "\x00RES"
  16. // package data type
  17. dtCanDo = 1
  18. dtCantDo = 2
  19. dtResetAbilities = 3
  20. dtPreSleep = 4
  21. dtNoop = 6
  22. dtJobCreated = 8
  23. dtGrabJob = 9
  24. dtNoJob = 10
  25. dtJobAssign = 11
  26. dtWorkStatus = 12
  27. dtWorkComplete = 13
  28. dtWorkFail = 14
  29. dtGetStatus = 15
  30. dtEchoReq = 16
  31. dtEchoRes = 17
  32. dtError = 19
  33. dtStatusRes = 20
  34. dtSetClientId = 22
  35. dtCanDoTimeout = 23
  36. dtAllYours = 24
  37. dtWorkException = 25
  38. dtWorkData = 28
  39. dtWorkWarning = 29
  40. dtGrabJobUniq = 30
  41. dtJobAssignUniq = 31
  42. )
  43. func getBuffer(l int) (buf []byte) {
  44. // TODO add byte buffer pool
  45. buf = make([]byte, l)
  46. return
  47. }