diff --git a/client/client.go b/client/client.go index e8f9d03..bf95cf4 100644 --- a/client/client.go +++ b/client/client.go @@ -62,7 +62,7 @@ func (r *responseHandlerMap) putNoLock(key string, rh ResponseHandler) { r.holder[key] = rh } -// Return a client. +// New returns a client. func New(network, addr string) (client *Client, err error) { client = &Client{ net: network, @@ -293,7 +293,7 @@ func (client *Client) DoBg(funcname string, data []byte, return } -// Get job status from job server. +// Status gets job status from job server. func (client *Client) Status(handle string) (status *Status, err error) { if client.conn == nil { return nil, ErrLostConn diff --git a/client/id.go b/client/id.go index 4c92e99..363f1cd 100644 --- a/client/id.go +++ b/client/id.go @@ -32,7 +32,7 @@ func (ai *autoincId) Id() string { return strconv.FormatInt(next, 10) } -// Return an autoincrement ID generator +// NewAutoIncId returns an autoincrement ID generator func NewAutoIncId() IdGenerator { // we'll consider the nano fraction of a second at startup unique // and count up from there. diff --git a/client/pool.go b/client/pool.go index 9b94888..6a205cd 100644 --- a/client/pool.go +++ b/client/pool.go @@ -57,7 +57,7 @@ type Pool struct { mutex sync.Mutex } -// Return a new pool. +// NewPool returns a new pool. func NewPool() (pool *Pool) { return &Pool{ Clients: make(map[string]*PoolClient, poolSize), @@ -111,7 +111,7 @@ func (pool *Pool) DoBg(funcname string, data []byte, return } -// Get job status from job server. +// Status gets job status from job server. // !!!Not fully tested.!!! func (pool *Pool) Status(addr, handle string) (status *Status, err error) { if client, ok := pool.Clients[addr]; ok { diff --git a/worker/worker.go b/worker/worker.go index dbaf49d..8ee04e6 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -30,7 +30,7 @@ type Worker struct { limit chan bool } -// Return a worker. +// New returns a worker. // // If limit is set to Unlimited(=0), the worker will grab all jobs // and execute them parallelly. @@ -56,7 +56,7 @@ func (worker *Worker) err(e error) { } } -// Add a Gearman job server. +// AddServer adds a Gearman job server. // // addr should be formated as 'host:port'. func (worker *Worker) AddServer(net, addr string) (err error) { @@ -76,7 +76,7 @@ func (worker *Worker) broadcast(outpack *outPack) { } } -// Add a function. +// AddFunc adds a function. // Set timeout as Unlimited(=0) to disable executing timeout. func (worker *Worker) AddFunc(funcname string, f JobFunc, timeout uint32) (err error) { @@ -116,7 +116,7 @@ func prepFuncOutpack(funcname string, timeout uint32) *outPack { return outpack } -// Remove a function. +// RemoveFunc removes a function. func (worker *Worker) RemoveFunc(funcname string) (err error) { worker.Lock() defer worker.Unlock() @@ -237,7 +237,7 @@ func (worker *Worker) Echo(data []byte) { worker.broadcast(outpack) } -// Remove all of functions. +// Reset removes all of functions. // Both from the worker and job servers. func (worker *Worker) Reset() { outpack := getOutPack()