docs: add some comments
This commit is contained in:
parent
ebe7b1fad5
commit
554083128b
4
worker/doc.go
Normal file
4
worker/doc.go
Normal file
@ -0,0 +1,4 @@
|
||||
// Processing unit
|
||||
//
|
||||
// Worker manages requests, queuing and re-queuing.
|
||||
package worker
|
@ -122,12 +122,15 @@ func (mgr *Worker) init() error {
|
||||
})
|
||||
}
|
||||
|
||||
// Cleanup internal resource.
|
||||
func (mgr *Worker) Close() {
|
||||
if fn := mgr.cleanup; fn != nil {
|
||||
fn()
|
||||
}
|
||||
}
|
||||
|
||||
// Enqueue request to storage, save meta-info to meta storage and push id into processing queue. Generated ID
|
||||
// always unique and returns only in case of successful enqueue.
|
||||
func (mgr *Worker) Enqueue(req *http.Request) (string, error) {
|
||||
id, err := mgr.saveRequest(req)
|
||||
if err != nil {
|
||||
@ -138,6 +141,7 @@ func (mgr *Worker) Enqueue(req *http.Request) (string, error) {
|
||||
return id, err
|
||||
}
|
||||
|
||||
// Complete request manually.
|
||||
func (mgr *Worker) Complete(requestID string) error {
|
||||
err := mgr.meta.Complete(requestID)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user