lp alerting and addtaskfunc doc
This commit is contained in:
parent
43680400c3
commit
1602b7b980
@ -26,6 +26,7 @@ import (
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/journal"
|
||||
"github.com/filecoin-project/lotus/journal/alerting"
|
||||
"github.com/filecoin-project/lotus/journal/fsjournal"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
@ -236,13 +237,15 @@ var runCmd = &cli.Command{
|
||||
}
|
||||
defer j.Close()
|
||||
|
||||
si := paths.NewIndexProxy( /*TODO Alerting*/ nil, db, true)
|
||||
al := alerting.NewAlertingSystem(j)
|
||||
si := paths.NewIndexProxy(al, db, true)
|
||||
|
||||
lstor, err := paths.NewLocal(ctx, lr, si, nil /*TODO URLs*/)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
full, fullCloser, err := cliutil.GetFullNodeAPIV1LotusProvider(cctx, cfg.Apis.FULLNODE_API_INFO) // TODO switch this into DB entries.
|
||||
|
||||
full, fullCloser, err := cliutil.GetFullNodeAPIV1LotusProvider(cctx, cfg.Apis.FULLNODE_API_INFO)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -254,7 +257,7 @@ var runCmd = &cli.Command{
|
||||
}
|
||||
|
||||
stor := paths.NewRemote(lstor, si, http.Header(sa), 10, &paths.DefaultPartialFileHandler{})
|
||||
mds, err := lr.Datastore(ctx, "/metadata")
|
||||
mds, err := lr.Datastore(ctx, "/metadata") // TODO rm datastore after sector-info moves to DB
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ type TaskInterface interface {
|
||||
// func (b *BazType)Adder(addTask AddTaskFunc) {
|
||||
// for {
|
||||
// bazMaker := <- bazChannel
|
||||
// addTask("baz", func(t harmonytask.TaskID, txn db.Transaction) bool {
|
||||
// addTask("baz", func(t harmonytask.TaskID, txn db.Transaction) (bool, error) {
|
||||
// _, err := txn.Exec(`INSERT INTO bazInfoTable (taskID, qix, mot)
|
||||
// VALUES ($1,$2,$3)`, id, bazMaker.qix, bazMaker.mot)
|
||||
// if err != nil {
|
||||
@ -90,6 +90,12 @@ type TaskInterface interface {
|
||||
Adder(AddTaskFunc)
|
||||
}
|
||||
|
||||
// AddTaskFunc is responsible for adding a task's details "extra info" to the DB.
|
||||
// It should return true if the task should be added, false if it was already there.
|
||||
// This is typically accomplished with a "unique" index on your detals table that
|
||||
// would cause the insert to fail.
|
||||
// The error indicates that instead of a conflict (which we should ignore) that we
|
||||
// actually have a serious problem that needs to be logged with context.
|
||||
type AddTaskFunc func(extraInfo func(TaskID, *harmonydb.Tx) (bool, error))
|
||||
|
||||
type TaskEngine struct {
|
||||
|
Loading…
Reference in New Issue
Block a user