func (t *Task) Fail() error {
	return t.guardResolution(func() error {
		return t.lifecycle.Abandon(t)
	})
}
Fail signals the lifecycle that work on this task has failed, causing
it to return the task to the main processing queue to be retried.
package worker
import (
	"encoding/hex"
	"errors"
	"sync"
)
var ErrAlreadyResolved = errors.New("Attempted to resolve an already-resolved task.")
type Task struct {
	lifecycle Lifecycle
	payload []byte
	resolved   bool
	resolvedMu sync.Mutex
}
func NewTask(lifecycle Lifecycle, payload []byte) *Task {
	return &Task{lifecycle: lifecycle, payload: payload}
}
func (t *Task) Bytes() []byte { return t.payload }
func (t *Task) SetBytes(bytes []byte) { t.payload = bytes }
func (t *Task) Succeed() error {
	return t.guardResolution(func() error {
		return t.lifecycle.Complete(t)
	})
}