Move curio packages to curiosrc
This commit is contained in:
parent
47fde12838
commit
f97036c1b0
4
Makefile
4
Makefile
@ -102,7 +102,7 @@ curio: $(BUILD_DEPS)
|
||||
$(GOCC) build $(GOFLAGS) -o curio -ldflags " \
|
||||
-X github.com/filecoin-project/lotus/curiosrc/build.IsOpencl=$(FFI_USE_OPENCL) \
|
||||
-X github.com/filecoin-project/lotus/curiosrc/build.Commit=`git log -1 --format=%h_%cI`" \
|
||||
./cmd/curio
|
||||
./curiosrc/cmd/curio
|
||||
.PHONY: curio
|
||||
BINS+=curio
|
||||
|
||||
@ -111,7 +111,7 @@ cu2k: curio
|
||||
|
||||
sptool: $(BUILD_DEPS)
|
||||
rm -f sptool
|
||||
$(GOCC) build $(GOFLAGS) -o sptool ./cmd/sptool
|
||||
$(GOCC) build $(GOFLAGS) -o sptool ./curiosrc/cmd/sptool
|
||||
.PHONY: sptool
|
||||
BINS+=sptool
|
||||
|
||||
|
@ -20,9 +20,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
harmonytask2 "github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
)
|
||||
@ -87,7 +87,7 @@ func NewAlertTask(api AlertAPI, db *harmonydb.DB, alertingCfg config.CurioAlerti
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AlertTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
func (a *AlertTask) Do(taskID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
if a.cfg.PageDutyIntegrationKey == "" {
|
||||
log.Warnf("PageDutyIntegrationKey is empty, not sending an alert")
|
||||
return true, nil
|
||||
@ -143,13 +143,13 @@ func (a *AlertTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done
|
||||
|
||||
}
|
||||
|
||||
func (a *AlertTask) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
func (a *AlertTask) CanAccept(ids []harmonytask2.TaskID, engine *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
id := ids[0]
|
||||
return &id, nil
|
||||
}
|
||||
|
||||
func (a *AlertTask) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
return harmonytask.TaskTypeDetails{
|
||||
func (a *AlertTask) TypeDetails() harmonytask2.TaskTypeDetails {
|
||||
return harmonytask2.TaskTypeDetails{
|
||||
Max: 1,
|
||||
Name: "AlertManager",
|
||||
Cost: resources.Resources{
|
||||
@ -157,15 +157,15 @@ func (a *AlertTask) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
Ram: 64 << 20,
|
||||
Gpu: 0,
|
||||
},
|
||||
IAmBored: harmonytask.SingletonTaskAdder(AlertMangerInterval, a),
|
||||
IAmBored: harmonytask2.SingletonTaskAdder(AlertMangerInterval, a),
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AlertTask) Adder(taskFunc harmonytask.AddTaskFunc) {
|
||||
func (a *AlertTask) Adder(taskFunc harmonytask2.AddTaskFunc) {
|
||||
return
|
||||
}
|
||||
|
||||
var _ harmonytask.TaskInterface = &AlertTask{}
|
||||
var _ harmonytask2.TaskInterface = &AlertTask{}
|
||||
|
||||
// sendAlert sends an alert to PagerDuty with the provided payload data.
|
||||
// It creates a PDData struct with the provided routing key, event action and payload.
|
||||
|
@ -20,8 +20,8 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
)
|
||||
|
||||
const providerEnvVar = "CURIO_API_INFO"
|
@ -15,7 +15,7 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
)
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/samber/lo"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
)
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect"
|
||||
ffidirect "github.com/filecoin-project/lotus/lib/ffiselect/ffidirect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect/ffidirect"
|
||||
"github.com/filecoin-project/lotus/lib/must"
|
||||
)
|
||||
|
@ -44,8 +44,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/cli/spcli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
_ "github.com/filecoin-project/lotus/cmd/curio/internal/translations"
|
||||
_ "github.com/filecoin-project/lotus/curiosrc/cmd/curio/internal/translations"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
@ -20,7 +20,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/must"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
@ -7,7 +7,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/rpc"
|
||||
)
|
||||
|
||||
var logCmd = &cli.Command{
|
@ -20,8 +20,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/guidedsetup"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/guidedsetup"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||
"github.com/filecoin-project/lotus/lib/tracing"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/market/lmrpc"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
)
|
@ -13,8 +13,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/guidedsetup"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/guidedsetup"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/seal"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
@ -15,8 +15,8 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
curio "github.com/filecoin-project/lotus/curiosrc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/client"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/market"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web"
|
||||
"github.com/filecoin-project/lotus/lib/rpcenc"
|
@ -12,9 +12,9 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/tasks"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/tasks"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/market/lmrpc"
|
||||
"github.com/filecoin-project/lotus/lib/ulimit"
|
||||
"github.com/filecoin-project/lotus/metrics"
|
@ -20,7 +20,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
@ -14,17 +14,17 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
curio "github.com/filecoin-project/lotus/curiosrc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/alertmanager"
|
||||
"github.com/filecoin-project/lotus/curiosrc/chainsched"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/gc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/message"
|
||||
"github.com/filecoin-project/lotus/curiosrc/piece"
|
||||
"github.com/filecoin-project/lotus/curiosrc/seal"
|
||||
"github.com/filecoin-project/lotus/curiosrc/winning"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/lazy"
|
||||
"github.com/filecoin-project/lotus/lib/must"
|
||||
"github.com/filecoin-project/lotus/node/modules"
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
|
@ -14,6 +14,9 @@ import (
|
||||
"github.com/puzpuzpuz/xsync/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
|
||||
// TODO everywhere here that we call this we should call our proxy instead.
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
commcid "github.com/filecoin-project/go-fil-commcid"
|
||||
@ -21,8 +24,6 @@ import (
|
||||
proof2 "github.com/filecoin-project/go-state-types/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/proof"
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/proofpaths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
storagePaths "github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/build"
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect/ffidirect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect/ffidirect"
|
||||
)
|
||||
|
||||
var IsTest = false
|
@ -6,7 +6,7 @@ import (
|
||||
"github.com/samber/lo"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect/ffidirect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect/ffidirect"
|
||||
)
|
||||
|
||||
func callTest(logctx []any, fn string, rawargs ...interface{}) ([]interface{}, error) {
|
@ -10,9 +10,9 @@ import (
|
||||
"github.com/samber/lo"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
harmonytask2 "github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/result"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
@ -39,7 +39,7 @@ func NewStorageEndpointGC(si *paths.DBIndex, remote *paths.Remote, db *harmonydb
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StorageEndpointGC) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
func (s *StorageEndpointGC) Do(taskID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
/*
|
||||
1. Get all storage paths + urls (endpoints)
|
||||
2. Ping each url, record results
|
||||
@ -262,13 +262,13 @@ func (s *StorageEndpointGC) Do(taskID harmonytask.TaskID, stillOwned func() bool
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (s *StorageEndpointGC) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
func (s *StorageEndpointGC) CanAccept(ids []harmonytask2.TaskID, engine *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
id := ids[0]
|
||||
return &id, nil
|
||||
}
|
||||
|
||||
func (s *StorageEndpointGC) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
return harmonytask.TaskTypeDetails{
|
||||
func (s *StorageEndpointGC) TypeDetails() harmonytask2.TaskTypeDetails {
|
||||
return harmonytask2.TaskTypeDetails{
|
||||
Max: 1,
|
||||
Name: "StorageMetaGC",
|
||||
Cost: resources.Resources{
|
||||
@ -276,13 +276,13 @@ func (s *StorageEndpointGC) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
Ram: 64 << 20,
|
||||
Gpu: 0,
|
||||
},
|
||||
IAmBored: harmonytask.SingletonTaskAdder(StorageEndpointGCInterval, s),
|
||||
IAmBored: harmonytask2.SingletonTaskAdder(StorageEndpointGCInterval, s),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StorageEndpointGC) Adder(taskFunc harmonytask.AddTaskFunc) {
|
||||
func (s *StorageEndpointGC) Adder(taskFunc harmonytask2.AddTaskFunc) {
|
||||
// lazy endpoint, added when bored
|
||||
return
|
||||
}
|
||||
|
||||
var _ harmonytask.TaskInterface = &StorageEndpointGC{}
|
||||
var _ harmonytask2.TaskInterface = &StorageEndpointGC{}
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
)
|
||||
|
||||
// Consts (except for unit test)
|
@ -2,12 +2,12 @@ package harmonytask
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/filecoin-project/lotus/curiosrc/lib/passcall"
|
||||
"time"
|
||||
|
||||
"github.com/yugabyte/pgx/v5"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/passcall"
|
||||
)
|
||||
|
||||
func SingletonTaskAdder(minInterval time.Duration, task TaskInterface) func(AddTaskFunc) error {
|
@ -16,9 +16,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
)
|
||||
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/chainsched"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
)
|
||||
|
||||
const MinConfidence = 6
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/seal"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
)
|
||||
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
)
|
||||
|
||||
func (s *SealPoller) pollStartCommitMsg(ctx context.Context, task pollTask) {
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
)
|
||||
|
||||
func (s *SealPoller) pollStartPrecommitMsg(ctx context.Context, task pollTask) {
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
@ -13,9 +13,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
|
@ -17,10 +17,10 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/filler"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
|
@ -21,11 +21,11 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/message"
|
||||
"github.com/filecoin-project/lotus/curiosrc/multictladdr"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
)
|
||||
|
@ -19,11 +19,11 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/message"
|
||||
"github.com/filecoin-project/lotus/curiosrc/multictladdr"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
)
|
||||
|
||||
|
@ -16,10 +16,10 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/filler"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffi"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/invopop/jsonschema"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/api/apihelper"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ package api
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/api/config"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/api/sector"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/api/webrpc"
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/cli/spcli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/api/apihelper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/filecoin-project/go-jsonrpc"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
)
|
||||
|
||||
var log = logging.Logger("webrpc")
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
)
|
||||
|
||||
//go:embed web/*
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
"go.opencensus.io/tag"
|
||||
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/api"
|
||||
"github.com/filecoin-project/lotus/curiosrc/web/hapi"
|
||||
"github.com/filecoin-project/lotus/metrics"
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
@ -24,10 +24,10 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/chainsched"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/taskhelp"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/taskhelp"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
|
@ -16,11 +16,11 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/chainsched"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/message"
|
||||
"github.com/filecoin-project/lotus/curiosrc/multictladdr"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
|
@ -16,11 +16,11 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/curiosrc/chainsched"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/curiosrc/message"
|
||||
"github.com/filecoin-project/lotus/curiosrc/multictladdr"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/storage/wdpost"
|
||||
)
|
||||
|
@ -26,10 +26,10 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
lrand "github.com/filecoin-project/lotus/chain/rand"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
|
@ -30,13 +30,13 @@ import (
|
||||
miner2 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/cli/spcli"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/tasks"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/ffiselect"
|
||||
"github.com/filecoin-project/lotus/curiosrc/market/lmrpc"
|
||||
"github.com/filecoin-project/lotus/curiosrc/seal"
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/lib/ffiselect"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/node"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
|
@ -12,17 +12,17 @@ import (
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
harmonytask2 "github.com/filecoin-project/lotus/curiosrc/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/curiosrc/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||
"github.com/filecoin-project/lotus/node/impl"
|
||||
)
|
||||
|
||||
type task1 struct {
|
||||
toAdd []int
|
||||
myPersonalTableLock sync.Mutex
|
||||
myPersonalTable map[harmonytask.TaskID]int // This would typically be a DB table
|
||||
myPersonalTable map[harmonytask2.TaskID]int // This would typically be a DB table
|
||||
WorkCompleted []string
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ func withDbSetup(t *testing.T, f func(*kit.TestMiner)) {
|
||||
f(miner)
|
||||
}
|
||||
|
||||
func (t *task1) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
func (t *task1) Do(taskID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
if !stillOwned() {
|
||||
return false, errors.New("Why not still owned?")
|
||||
}
|
||||
@ -46,11 +46,11 @@ func (t *task1) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool
|
||||
t.WorkCompleted = append(t.WorkCompleted, fmt.Sprintf("taskResult%d", t.myPersonalTable[taskID]))
|
||||
return true, nil
|
||||
}
|
||||
func (t *task1) CanAccept(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
func (t *task1) CanAccept(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
return &list[0], nil
|
||||
}
|
||||
func (t *task1) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
return harmonytask.TaskTypeDetails{
|
||||
func (t *task1) TypeDetails() harmonytask2.TaskTypeDetails {
|
||||
return harmonytask2.TaskTypeDetails{
|
||||
Max: 100,
|
||||
Name: "ThingOne",
|
||||
MaxFailures: 1,
|
||||
@ -60,10 +60,10 @@ func (t *task1) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
},
|
||||
}
|
||||
}
|
||||
func (t *task1) Adder(add harmonytask.AddTaskFunc) {
|
||||
func (t *task1) Adder(add harmonytask2.AddTaskFunc) {
|
||||
for _, vTmp := range t.toAdd {
|
||||
v := vTmp
|
||||
add(func(tID harmonytask.TaskID, tx *harmonydb.Tx) (bool, error) {
|
||||
add(func(tID harmonytask2.TaskID, tx *harmonydb.Tx) (bool, error) {
|
||||
t.myPersonalTableLock.Lock()
|
||||
defer t.myPersonalTableLock.Unlock()
|
||||
|
||||
@ -84,10 +84,10 @@ func TestHarmonyTasks(t *testing.T) {
|
||||
cdb := m.BaseAPI.(*impl.StorageMinerAPI).HarmonyDB
|
||||
t1 := &task1{
|
||||
toAdd: []int{56, 73},
|
||||
myPersonalTable: map[harmonytask.TaskID]int{},
|
||||
myPersonalTable: map[harmonytask2.TaskID]int{},
|
||||
}
|
||||
harmonytask.POLL_DURATION = time.Millisecond * 100
|
||||
e, err := harmonytask.New(cdb, []harmonytask.TaskInterface{t1}, "test:1")
|
||||
harmonytask2.POLL_DURATION = time.Millisecond * 100
|
||||
e, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{t1}, "test:1")
|
||||
require.NoError(t, err)
|
||||
time.Sleep(time.Second) // do the work. FLAKYNESS RISK HERE.
|
||||
e.GracefullyTerminate()
|
||||
@ -98,41 +98,41 @@ func TestHarmonyTasks(t *testing.T) {
|
||||
}
|
||||
|
||||
type passthru struct {
|
||||
dtl harmonytask.TaskTypeDetails
|
||||
do func(tID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
|
||||
canAccept func(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
|
||||
adder func(add harmonytask.AddTaskFunc)
|
||||
dtl harmonytask2.TaskTypeDetails
|
||||
do func(tID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error)
|
||||
canAccept func(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error)
|
||||
adder func(add harmonytask2.AddTaskFunc)
|
||||
}
|
||||
|
||||
func (t *passthru) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
func (t *passthru) Do(taskID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
return t.do(taskID, stillOwned)
|
||||
}
|
||||
func (t *passthru) CanAccept(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
func (t *passthru) CanAccept(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
return t.canAccept(list, e)
|
||||
}
|
||||
func (t *passthru) TypeDetails() harmonytask.TaskTypeDetails {
|
||||
func (t *passthru) TypeDetails() harmonytask2.TaskTypeDetails {
|
||||
return t.dtl
|
||||
}
|
||||
func (t *passthru) Adder(add harmonytask.AddTaskFunc) {
|
||||
func (t *passthru) Adder(add harmonytask2.AddTaskFunc) {
|
||||
if t.adder != nil {
|
||||
t.adder(add)
|
||||
}
|
||||
}
|
||||
|
||||
// Common stuff
|
||||
var dtl = harmonytask.TaskTypeDetails{Name: "foo", Max: -1, Cost: resources.Resources{}}
|
||||
var dtl = harmonytask2.TaskTypeDetails{Name: "foo", Max: -1, Cost: resources.Resources{}}
|
||||
var lettersMutex sync.Mutex
|
||||
|
||||
func fooLetterAdder(t *testing.T, cdb *harmonydb.DB) *passthru {
|
||||
return &passthru{
|
||||
dtl: dtl,
|
||||
canAccept: func(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
canAccept: func(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
return nil, nil
|
||||
},
|
||||
adder: func(add harmonytask.AddTaskFunc) {
|
||||
adder: func(add harmonytask2.AddTaskFunc) {
|
||||
for _, vTmp := range []string{"A", "B"} {
|
||||
v := vTmp
|
||||
add(func(tID harmonytask.TaskID, tx *harmonydb.Tx) (bool, error) {
|
||||
add(func(tID harmonytask2.TaskID, tx *harmonydb.Tx) (bool, error) {
|
||||
_, err := tx.Exec("INSERT INTO itest_scratch (some_int, content) VALUES ($1,$2)", tID, v)
|
||||
require.NoError(t, err)
|
||||
return true, nil
|
||||
@ -144,10 +144,10 @@ func fooLetterAdder(t *testing.T, cdb *harmonydb.DB) *passthru {
|
||||
func fooLetterSaver(t *testing.T, cdb *harmonydb.DB, dest *[]string) *passthru {
|
||||
return &passthru{
|
||||
dtl: dtl,
|
||||
canAccept: func(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
canAccept: func(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
return &list[0], nil
|
||||
},
|
||||
do: func(tID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
do: func(tID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
var content string
|
||||
err = cdb.QueryRow(context.Background(),
|
||||
"SELECT content FROM itest_scratch WHERE some_int=$1", tID).Scan(&content)
|
||||
@ -167,10 +167,10 @@ func TestHarmonyTasksWith2PartiesPolling(t *testing.T) {
|
||||
senderParty := fooLetterAdder(t, cdb)
|
||||
var dest []string
|
||||
workerParty := fooLetterSaver(t, cdb, &dest)
|
||||
harmonytask.POLL_DURATION = time.Millisecond * 100
|
||||
sender, err := harmonytask.New(cdb, []harmonytask.TaskInterface{senderParty}, "test:1")
|
||||
harmonytask2.POLL_DURATION = time.Millisecond * 100
|
||||
sender, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{senderParty}, "test:1")
|
||||
require.NoError(t, err)
|
||||
worker, err := harmonytask.New(cdb, []harmonytask.TaskInterface{workerParty}, "test:2")
|
||||
worker, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{workerParty}, "test:2")
|
||||
require.NoError(t, err)
|
||||
time.Sleep(time.Second) // do the work. FLAKYNESS RISK HERE.
|
||||
sender.GracefullyTerminate()
|
||||
@ -198,10 +198,10 @@ func TestWorkStealing(t *testing.T) {
|
||||
_, err = cdb.Exec(ctx, "INSERT INTO itest_scratch (some_int, content) VALUES (1234, 'M')")
|
||||
require.ErrorIs(t, err, nil)
|
||||
|
||||
harmonytask.POLL_DURATION = time.Millisecond * 100
|
||||
harmonytask.CLEANUP_FREQUENCY = time.Millisecond * 100
|
||||
harmonytask2.POLL_DURATION = time.Millisecond * 100
|
||||
harmonytask2.CLEANUP_FREQUENCY = time.Millisecond * 100
|
||||
var dest []string
|
||||
worker, err := harmonytask.New(cdb, []harmonytask.TaskInterface{fooLetterSaver(t, cdb, &dest)}, "test:2")
|
||||
worker, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{fooLetterSaver(t, cdb, &dest)}, "test:2")
|
||||
require.ErrorIs(t, err, nil)
|
||||
time.Sleep(time.Second) // do the work. FLAKYNESS RISK HERE.
|
||||
worker.GracefullyTerminate()
|
||||
@ -214,18 +214,18 @@ func TestTaskRetry(t *testing.T) {
|
||||
withDbSetup(t, func(m *kit.TestMiner) {
|
||||
cdb := m.BaseAPI.(*impl.StorageMinerAPI).HarmonyDB
|
||||
senderParty := fooLetterAdder(t, cdb)
|
||||
harmonytask.POLL_DURATION = time.Millisecond * 100
|
||||
sender, err := harmonytask.New(cdb, []harmonytask.TaskInterface{senderParty}, "test:1")
|
||||
harmonytask2.POLL_DURATION = time.Millisecond * 100
|
||||
sender, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{senderParty}, "test:1")
|
||||
require.NoError(t, err)
|
||||
|
||||
alreadyFailed := map[string]bool{}
|
||||
var dest []string
|
||||
fails2xPerMsg := &passthru{
|
||||
dtl: dtl,
|
||||
canAccept: func(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
canAccept: func(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
return &list[0], nil
|
||||
},
|
||||
do: func(tID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
do: func(tID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
var content string
|
||||
err = cdb.QueryRow(context.Background(),
|
||||
"SELECT content FROM itest_scratch WHERE some_int=$1", tID).Scan(&content)
|
||||
@ -240,7 +240,7 @@ func TestTaskRetry(t *testing.T) {
|
||||
return true, nil
|
||||
},
|
||||
}
|
||||
rcv, err := harmonytask.New(cdb, []harmonytask.TaskInterface{fails2xPerMsg}, "test:2")
|
||||
rcv, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{fails2xPerMsg}, "test:2")
|
||||
require.NoError(t, err)
|
||||
time.Sleep(time.Second)
|
||||
sender.GracefullyTerminate()
|
||||
@ -269,33 +269,33 @@ func TestBoredom(t *testing.T) {
|
||||
//t.Parallel()
|
||||
withDbSetup(t, func(m *kit.TestMiner) {
|
||||
cdb := m.BaseAPI.(*impl.StorageMinerAPI).HarmonyDB
|
||||
harmonytask.POLL_DURATION = time.Millisecond * 100
|
||||
var taskID harmonytask.TaskID
|
||||
harmonytask2.POLL_DURATION = time.Millisecond * 100
|
||||
var taskID harmonytask2.TaskID
|
||||
var ran bool
|
||||
boredParty := &passthru{
|
||||
dtl: harmonytask.TaskTypeDetails{
|
||||
dtl: harmonytask2.TaskTypeDetails{
|
||||
Name: "boredTest",
|
||||
Max: -1,
|
||||
Cost: resources.Resources{},
|
||||
IAmBored: func(add harmonytask.AddTaskFunc) error {
|
||||
add(func(tID harmonytask.TaskID, tx *harmonydb.Tx) (bool, error) {
|
||||
IAmBored: func(add harmonytask2.AddTaskFunc) error {
|
||||
add(func(tID harmonytask2.TaskID, tx *harmonydb.Tx) (bool, error) {
|
||||
taskID = tID
|
||||
return true, nil
|
||||
})
|
||||
return nil
|
||||
},
|
||||
},
|
||||
canAccept: func(list []harmonytask.TaskID, e *harmonytask.TaskEngine) (*harmonytask.TaskID, error) {
|
||||
require.Equal(t, harmonytask.WorkSourceIAmBored, e.WorkOrigin)
|
||||
canAccept: func(list []harmonytask2.TaskID, e *harmonytask2.TaskEngine) (*harmonytask2.TaskID, error) {
|
||||
require.Equal(t, harmonytask2.WorkSourceIAmBored, e.WorkOrigin)
|
||||
return &list[0], nil
|
||||
},
|
||||
do: func(tID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
do: func(tID harmonytask2.TaskID, stillOwned func() bool) (done bool, err error) {
|
||||
require.Equal(t, taskID, tID)
|
||||
ran = true
|
||||
return true, nil
|
||||
},
|
||||
}
|
||||
ht, err := harmonytask.New(cdb, []harmonytask.TaskInterface{boredParty}, "test:1")
|
||||
ht, err := harmonytask2.New(cdb, []harmonytask2.TaskInterface{boredParty}, "test:1")
|
||||
require.NoError(t, err)
|
||||
require.Eventually(t, func() bool { return ran }, time.Second, time.Millisecond*100)
|
||||
ht.GracefullyTerminate()
|
||||
|
@ -46,11 +46,11 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/rpc"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/tasks"
|
||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
||||
"github.com/filecoin-project/lotus/cmd/lotus-worker/sealworker"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/gateway"
|
||||
"github.com/filecoin-project/lotus/genesis"
|
||||
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
||||
"github.com/filecoin-project/lotus/curiosrc/deps"
|
||||
"github.com/filecoin-project/lotus/gateway"
|
||||
"github.com/filecoin-project/lotus/node"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user