2020-03-11 01:57:52 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-05-26 08:20:32 +00:00
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/ipfs/go-cid"
|
2020-03-11 01:57:52 +00:00
|
|
|
|
2020-04-28 10:57:24 +00:00
|
|
|
"github.com/filecoin-project/sector-storage/sealtasks"
|
|
|
|
"github.com/filecoin-project/sector-storage/stores"
|
2020-04-23 22:23:20 +00:00
|
|
|
"github.com/filecoin-project/sector-storage/storiface"
|
2020-04-28 10:57:24 +00:00
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
2020-03-11 01:57:52 +00:00
|
|
|
"github.com/filecoin-project/specs-storage/storage"
|
|
|
|
|
|
|
|
"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-08-14 14:06:53 +00:00
|
|
|
AddPiece(ctx context.Context, sector abi.SectorID, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error)
|
|
|
|
|
2020-03-11 01:57:52 +00:00
|
|
|
storage.Sealer
|
2020-05-26 08:20:32 +00:00
|
|
|
|
2020-06-04 13:54:54 +00:00
|
|
|
MoveStorage(ctx context.Context, sector abi.SectorID) error
|
|
|
|
|
2020-05-26 08:20:32 +00:00
|
|
|
UnsealPiece(context.Context, abi.SectorID, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) error
|
2020-07-30 21:51:22 +00:00
|
|
|
ReadPiece(context.Context, io.Writer, abi.SectorID, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize) (bool, error)
|
2020-05-26 08:20:32 +00:00
|
|
|
|
2020-06-04 19:22:53 +00:00
|
|
|
Fetch(context.Context, abi.SectorID, stores.SectorFileType, stores.PathType, stores.AcquireMode) error
|
2020-05-01 18:15:06 +00:00
|
|
|
|
|
|
|
Closing(context.Context) (<-chan struct{}, error)
|
2020-03-11 01:57:52 +00:00
|
|
|
}
|