worker: Fetch task type

This commit is contained in:
Łukasz Magiera 2020-04-27 14:55:37 +02:00
parent f59d6b971b
commit 5bea676ce3
4 changed files with 14 additions and 2 deletions

View File

@ -104,6 +104,15 @@ func (l *LocalWorker) AddPiece(ctx context.Context, sector abi.SectorID, epcs []
return sb.AddPiece(ctx, sector, epcs, sz, r) return sb.AddPiece(ctx, sector, epcs, sz, r)
} }
func (l *LocalWorker) Fetch(ctx context.Context, sector abi.SectorID, fileType stores.SectorFileType, sealing bool) error {
_, done, err := (&localWorkerPathProvider{w: l}).AcquireSector(ctx, sector, fileType, stores.FTNone, sealing)
if err != nil {
return err
}
done()
return nil
}
func (l *LocalWorker) SealPreCommit1(ctx context.Context, sector abi.SectorID, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage2.PreCommit1Out, err error) { func (l *LocalWorker) SealPreCommit1(ctx context.Context, sector abi.SectorID, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage2.PreCommit1Out, err error) {
sb, err := l.sb() sb, err := l.sb()
if err != nil { if err != nil {

View File

@ -30,6 +30,7 @@ type URLs []string
type Worker interface { type Worker interface {
ffiwrapper.StorageSealer ffiwrapper.StorageSealer
Fetch(context.Context, abi.SectorID, stores.SectorFileType, bool) error
TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error)
@ -122,7 +123,7 @@ func New(ctx context.Context, ls stores.LocalStorage, si stores.SectorIndex, cfg
go m.runSched() go m.runSched()
localTasks := []sealtasks.TaskType{ localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTAddPiece, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch,
} }
if sc.AllowPreCommit1 { if sc.AllowPreCommit1 {
localTasks = append(localTasks, sealtasks.TTPreCommit1) localTasks = append(localTasks, sealtasks.TTPreCommit1)

View File

@ -10,4 +10,6 @@ const (
TTCommit2 TaskType = "seal/v0/commit/2" TTCommit2 TaskType = "seal/v0/commit/2"
TTFinalize TaskType = "seal/v0/finalize" TTFinalize TaskType = "seal/v0/finalize"
TTFetch TaskType = "seal/v0/fetch"
) )

View File

@ -22,5 +22,5 @@ type WorkerStats struct {
MemUsedMin uint64 MemUsedMin uint64
MemUsedMax uint64 MemUsedMax uint64
GpuUsed bool GpuUsed bool
CpuUse int CpuUse uint64
} }