Documentation ¶
Index ¶
- Constants
- func GetBuffer(n int) (buf []byte)
- func GetStrParamsArr(params []byte) []string
- type Agent
- type Config
- type Function
- type Job
- type JobFunc
- type Request
- func (req *Request) AddFunctionPack(funcName string) (content []byte, err error)
- func (req *Request) DelFunctionPack(funcName string) (content []byte, err error)
- func (req *Request) EncodePack() (data []byte)
- func (req *Request) GrabDataPack() (content []byte, err error)
- func (req *Request) RetPack(ret []byte) (content []byte, err error)
- func (req *Request) WakeupPack()
- type Response
- type RetStruct
- type Server
- type Worker
- func (w *Worker) AddFunction(funcName string, jobFunc JobFunc) (err error)
- func (w *Worker) AddServer(net, addr string) (err error)
- func (w *Worker) DelFunction(funcName string) (err error)
- func (w *Worker) DoFunction(resp *Response) (err error)
- func (w *Worker) FuncBroadcast(funcName string, flag int)
- func (w *Worker) GetFunction(funcName string) (function *Function, err error)
- func (w *Worker) WorkerClose() error
- func (w *Worker) WorkerDo()
- func (w *Worker) WorkerReady() (err error)
Constants ¶
View Source
const ( MIN_DATA_SIZE = 12 UINT32_SIZE = 4 QUEUE_SIZE = 64 BUFFER_SIZE = 512 PARAMS_SCOPE = 0x3A //package data type PDT_OK = 1 PDT_ERROR = 2 PDT_CAN_DO = 3 PDT_CANT_DO = 4 PDT_NO_JOB = 5 PDT_HAVE_JOB = 6 PDT_TOSLEEP = 7 PDT_WAKEUP = 8 PDT_WAKEUPED = 9 PDT_S_GET_DATA = 10 PDT_S_RETURN_DATA = 11 PDT_W_GRAB_JOB = 12 PDT_W_ADD_FUNC = 13 PDT_W_DEL_FUNC = 14 PDT_W_RETURN_DATA = 15 PDT_C_DO_JOB = 16 PDT_C_GET_DATA = 17 )
View Source
const ( CONN_TYPE_INIT = 0 CONN_TYPE_SERVER = 1 CONN_TYPE_WORKER = 2 CONN_TYPE_CLIENT = 3 PARAMS_TYPE_ONE = 4 PARAMS_TYPE_MUL = 5 JOB_STATUS_INIT = 6 JOB_STATUS_DOING = 7 JOB_STATUS_DONE = 8 )
Variables ¶
This section is empty.
Functions ¶
func GetStrParamsArr ¶
Types ¶
type Agent ¶
type Function ¶
func NewFunction ¶
type Request ¶
type Request struct { DataType uint32 Data []byte DataLen uint32 Handle string HandleLen uint32 ParamsType uint32 ParamsLen uint32 Params []byte Ret []byte RetLen uint32 }
func (*Request) AddFunctionPack ¶
打包内容-添加方法
func (*Request) DelFunctionPack ¶
打包内容-删除方法
func (*Request) GrabDataPack ¶
打包内容-抓取任务
type Response ¶
type Response struct { DataType uint32 Data []byte DataLen uint32 Handle string HandleLen uint32 ParamsType uint32 ParamsNum uint32 ParamsLen uint32 Params []byte StrParams []string Ret []byte RetLen uint32 Agent *Agent }
func (*Response) GetResponse ¶
func (*Response) GetStrParams ¶
func (*Response) ParseParams ¶
type RetStruct ¶
func GetRetStruct ¶
func GetRetStruct() *RetStruct
type Server ¶
type Server struct { *Config // contains filtered or unexported fields }
Server ...
func (*Server) GracefulStop ¶
GracefulStop ..
type Worker ¶
type Worker struct { sync.Mutex Agents []*Agent Funcs map[string]*Function FuncsNum int Resps chan *Response // contains filtered or unexported fields }
func (*Worker) AddFunction ¶
func (*Worker) DelFunction ¶
func (*Worker) DoFunction ¶
func (*Worker) FuncBroadcast ¶
func (*Worker) GetFunction ¶
func (*Worker) WorkerClose ¶
func (*Worker) WorkerReady ¶
Click to show internal directories.
Click to hide internal directories.