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.
40 lines
776 B
40 lines
776 B
package task |
|
|
|
import ( |
|
"io" |
|
"os" |
|
|
|
"github.com/liangdas/armyant/task" |
|
) |
|
|
|
type Manager struct { |
|
// Writer is where results will be written. If nil, results are written to stdout. |
|
Writer io.Writer |
|
Addr string |
|
Number int |
|
GameKind int |
|
} |
|
|
|
func (this *Manager) writer() io.Writer { |
|
if this.Writer == nil { |
|
return os.Stdout |
|
} |
|
return this.Writer |
|
} |
|
func (this *Manager) Finish(task task.Task) { |
|
} |
|
|
|
func (this *Manager) CreateWork() task.Work { |
|
return NewWork(this) |
|
} |
|
|
|
// Run makes all the requests, prints the summary. It blocks until |
|
// all work is done. |
|
func NewManager(t task.Task, addr string, start int, game int) task.WorkManager { |
|
// append hey's user agent |
|
this := new(Manager) |
|
this.Addr = addr |
|
this.Number = start |
|
this.GameKind = game |
|
return this |
|
}
|
|
|