2020-03-11 01:57:52 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-05-26 08:20:32 +00:00
|
|
|
|
2020-10-18 10:35:44 +00:00
|
|
|
"github.com/google/uuid"
|
|
|
|
|
2020-09-07 03:49:10 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2020-08-17 13:26:18 +00:00
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
2020-03-11 01:57:52 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
|
|
)
|
|
|
|
|
2020-05-27 20:53:20 +00:00
|
|
|
type WorkerAPI interface {
|
2020-03-11 01:57:52 +00:00
|
|
|
Version(context.Context) (build.Version, error)
|
|
|
|
// TODO: Info() (name, ...) ?
|
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) // TaskType -> Weight
|
2020-03-13 11:59:19 +00:00
|
|
|
Paths(context.Context) ([]stores.StoragePath, error)
|
2020-04-23 22:23:20 +00:00
|
|
|
Info(context.Context) (storiface.WorkerInfo, error)
|
2020-03-11 01:57:52 +00:00
|
|
|
|
2020-09-06 16:47:16 +00:00
|
|
|
storiface.WorkerCalls
|
2020-05-26 08:20:32 +00:00
|
|
|
|
2020-11-30 22:16:30 +00:00
|
|
|
TaskDisable(ctx context.Context, tt sealtasks.TaskType) error
|
|
|
|
TaskEnable(ctx context.Context, tt sealtasks.TaskType) error
|
2020-11-26 16:33:22 +00:00
|
|
|
|
2020-09-06 16:47:16 +00:00
|
|
|
// Storage / Other
|
|
|
|
Remove(ctx context.Context, sector abi.SectorID) error
|
2020-05-26 08:20:32 +00:00
|
|
|
|
2020-08-30 18:28:58 +00:00
|
|
|
StorageAddLocal(ctx context.Context, path string) error
|
|
|
|
|
2020-10-27 16:28:44 +00:00
|
|
|
// SetEnabled marks the worker as enabled/disabled. Not that this setting
|
|
|
|
// may take a few seconds to propagate to task scheduler
|
|
|
|
SetEnabled(ctx context.Context, enabled bool) error
|
|
|
|
|
|
|
|
Enabled(ctx context.Context) (bool, error)
|
|
|
|
|
|
|
|
// WaitQuiet blocks until there are no tasks running
|
|
|
|
WaitQuiet(ctx context.Context) error
|
|
|
|
|
|
|
|
// returns a random UUID of worker session, generated randomly when worker
|
|
|
|
// process starts
|
|
|
|
ProcessSession(context.Context) (uuid.UUID, error)
|
|
|
|
|
|
|
|
// Like ProcessSession, but returns an error when worker is disabled
|
2020-10-18 10:35:44 +00:00
|
|
|
Session(context.Context) (uuid.UUID, error)
|
2020-03-11 01:57:52 +00:00
|
|
|
}
|