From 5bea676ce320a2382243abde0e067b89102b5ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 27 Apr 2020 14:55:37 +0200 Subject: [PATCH] worker: Fetch task type --- localworker.go | 9 +++++++++ manager.go | 3 ++- sealtasks/task.go | 2 ++ storiface/worker.go | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/localworker.go b/localworker.go index 0952b5882..f3f12e8c1 100644 --- a/localworker.go +++ b/localworker.go @@ -104,6 +104,15 @@ func (l *LocalWorker) AddPiece(ctx context.Context, sector abi.SectorID, epcs [] 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) { sb, err := l.sb() if err != nil { diff --git a/manager.go b/manager.go index f0b6308c9..e5150b3de 100644 --- a/manager.go +++ b/manager.go @@ -30,6 +30,7 @@ type URLs []string type Worker interface { ffiwrapper.StorageSealer + Fetch(context.Context, abi.SectorID, stores.SectorFileType, bool) 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() localTasks := []sealtasks.TaskType{ - sealtasks.TTAddPiece, sealtasks.TTCommit1, sealtasks.TTFinalize, + sealtasks.TTAddPiece, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, } if sc.AllowPreCommit1 { localTasks = append(localTasks, sealtasks.TTPreCommit1) diff --git a/sealtasks/task.go b/sealtasks/task.go index 8eefa14fa..8fbe7a7b4 100644 --- a/sealtasks/task.go +++ b/sealtasks/task.go @@ -10,4 +10,6 @@ const ( TTCommit2 TaskType = "seal/v0/commit/2" TTFinalize TaskType = "seal/v0/finalize" + + TTFetch TaskType = "seal/v0/fetch" ) diff --git a/storiface/worker.go b/storiface/worker.go index 27442206d..0f49e8971 100644 --- a/storiface/worker.go +++ b/storiface/worker.go @@ -22,5 +22,5 @@ type WorkerStats struct { MemUsedMin uint64 MemUsedMax uint64 GpuUsed bool - CpuUse int + CpuUse uint64 }