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"
|
2021-03-23 12:42:56 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
2020-10-18 10:35:44 +00:00
|
|
|
|
2020-09-07 03:49:10 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2022-06-14 15:00:51 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/proof"
|
|
|
|
|
2022-06-14 18:03:38 +00:00
|
|
|
"github.com/filecoin-project/lotus/storage/sealer/sealtasks"
|
2022-06-15 10:06:22 +00:00
|
|
|
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
2020-03-11 01:57:52 +00:00
|
|
|
)
|
|
|
|
|
2021-04-26 18:36:20 +00:00
|
|
|
// MODIFYING THE API INTERFACE
|
|
|
|
//
|
|
|
|
// When adding / changing methods in this file:
|
|
|
|
// * Do the change here
|
|
|
|
// * Adjust implementation in `node/impl/`
|
|
|
|
// * Run `make gen` - this will:
|
|
|
|
// * Generate proxy structs
|
|
|
|
// * Generate mocks
|
|
|
|
// * Generate markdown docs
|
|
|
|
// * Generate openrpc blobs
|
|
|
|
|
2021-03-23 12:42:56 +00:00
|
|
|
type Worker interface {
|
|
|
|
Version(context.Context) (Version, error) //perm:admin
|
|
|
|
|
|
|
|
// TaskType -> Weight
|
|
|
|
TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) //perm:admin
|
2022-01-18 10:57:04 +00:00
|
|
|
Paths(context.Context) ([]storiface.StoragePath, error) //perm:admin
|
2021-03-23 12:42:56 +00:00
|
|
|
Info(context.Context) (storiface.WorkerInfo, error) //perm:admin
|
|
|
|
|
|
|
|
// storiface.WorkerCalls
|
2022-06-17 11:31:05 +00:00
|
|
|
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) //perm:admin
|
|
|
|
AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) //perm:admin
|
|
|
|
SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
|
|
|
|
SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) //perm:admin
|
|
|
|
SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) //perm:admin
|
|
|
|
SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) //perm:admin
|
|
|
|
FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
|
|
|
|
FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
|
|
|
|
ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
|
|
|
|
ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) //perm:admin
|
|
|
|
ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) //perm:admin
|
|
|
|
GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) //perm:admin
|
|
|
|
ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) //perm:admin
|
|
|
|
MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin
|
|
|
|
UnsealPiece(context.Context, storiface.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
|
|
|
|
Fetch(context.Context, storiface.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin
|
2022-01-14 13:11:04 +00:00
|
|
|
|
|
|
|
GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error) //perm:admin
|
|
|
|
GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) //perm:admin
|
2021-03-23 12:42:56 +00:00
|
|
|
|
|
|
|
TaskDisable(ctx context.Context, tt sealtasks.TaskType) error //perm:admin
|
|
|
|
TaskEnable(ctx context.Context, tt sealtasks.TaskType) error //perm:admin
|
2020-11-26 16:33:22 +00:00
|
|
|
|
2020-09-06 16:47:16 +00:00
|
|
|
// Storage / Other
|
2021-03-23 12:42:56 +00:00
|
|
|
Remove(ctx context.Context, sector abi.SectorID) error //perm:admin
|
2020-05-26 08:20:32 +00:00
|
|
|
|
2021-03-23 12:42:56 +00:00
|
|
|
StorageAddLocal(ctx context.Context, path string) error //perm:admin
|
2020-08-30 18:28:58 +00:00
|
|
|
|
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
|
2021-03-23 12:42:56 +00:00
|
|
|
SetEnabled(ctx context.Context, enabled bool) error //perm:admin
|
2020-10-27 16:28:44 +00:00
|
|
|
|
2021-03-23 12:42:56 +00:00
|
|
|
Enabled(ctx context.Context) (bool, error) //perm:admin
|
2020-10-27 16:28:44 +00:00
|
|
|
|
|
|
|
// WaitQuiet blocks until there are no tasks running
|
2021-03-23 12:42:56 +00:00
|
|
|
WaitQuiet(ctx context.Context) error //perm:admin
|
2020-10-27 16:28:44 +00:00
|
|
|
|
|
|
|
// returns a random UUID of worker session, generated randomly when worker
|
|
|
|
// process starts
|
2021-03-23 12:42:56 +00:00
|
|
|
ProcessSession(context.Context) (uuid.UUID, error) //perm:admin
|
2020-10-27 16:28:44 +00:00
|
|
|
|
|
|
|
// Like ProcessSession, but returns an error when worker is disabled
|
2021-03-23 12:42:56 +00:00
|
|
|
Session(context.Context) (uuid.UUID, error) //perm:admin
|
2022-07-29 22:33:30 +00:00
|
|
|
|
|
|
|
// Trigger shutdown
|
|
|
|
Shutdown(context.Context) error //perm:admin
|
|
|
|
|
2020-03-11 01:57:52 +00:00
|
|
|
}
|
2021-03-23 12:42:56 +00:00
|
|
|
|
|
|
|
var _ storiface.WorkerCalls = *new(Worker)
|