empact/job/management.go

27 lines
349 B
Go
Raw Normal View History

2015-03-04 18:43:44 +07:00
package job
import (
"time"
"code.google.com/p/go-uuid/uuid"
2015-03-05 02:08:36 +07:00
"github.com/fatih/structs"
2015-03-04 18:43:44 +07:00
)
type (
2015-03-05 02:08:36 +07:00
Task struct{}
2015-03-04 18:43:44 +07:00
report struct {
duration time.Duration
2015-03-05 02:08:36 +07:00
err error
2015-03-04 18:43:44 +07:00
}
)
func newID() string {
return uuid.New()
}
2015-03-05 02:08:36 +07:00
func (t *Task) report(rep report) {
meta := structs.Map(t)
meta["duration"] = rep.duration
meta["error"] = rep.err
}