worker: Cleanup sealed sector data in commit

This commit is contained in:
Łukasz Magiera 2020-01-15 02:24:13 +01:00
parent a8e39962d0
commit 1163e46622
2 changed files with 9 additions and 0 deletions

View File

@ -127,6 +127,10 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
if err := w.push("cache", task.SectorID); err != nil {
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
}
if err := w.remove("sealed", task.SectorID); err != nil {
return errRes(xerrors.Errorf("cleaning up sealed sector: %w", err))
}
}
return res

View File

@ -125,6 +125,11 @@ func (w *worker) push(typ string, sectorID uint64) error {
}
// TODO: keep files around for later stages of sealing
return w.remove(typ, sectorID)
}
func (w *worker) remove(typ string, sectorID uint64) error {
filename := filepath.Join(w.repo, typ, w.sb.SectorName(sectorID))
return os.RemoveAll(filename)
}