worker_local: address review

This commit is contained in:
Łukasz Magiera 2020-10-28 14:29:17 +01:00
parent 96c5ff7e7f
commit 4cf00b8b42

View File

@ -35,13 +35,16 @@ type WorkerConfig struct {
NoSwap bool NoSwap bool
} }
// used do provide custom proofs impl (mostly used in testing)
type ExecutorFunc func() (ffiwrapper.Storage, error)
type LocalWorker struct { type LocalWorker struct {
scfg *ffiwrapper.Config scfg *ffiwrapper.Config
storage stores.Store storage stores.Store
localStore *stores.Local localStore *stores.Local
sindex stores.SectorIndex sindex stores.SectorIndex
ret storiface.WorkerReturn ret storiface.WorkerReturn
executor func() (ffiwrapper.Storage, error) executor ExecutorFunc
noSwap bool noSwap bool
ct *workerCallTracker ct *workerCallTracker
@ -52,7 +55,7 @@ type LocalWorker struct {
closing chan struct{} closing chan struct{}
} }
func newLocalWorker(executor func() (ffiwrapper.Storage, error), wcfg WorkerConfig, store stores.Store, local *stores.Local, sindex stores.SectorIndex, ret storiface.WorkerReturn, cst *statestore.StateStore) *LocalWorker { func newLocalWorker(executor ExecutorFunc, wcfg WorkerConfig, store stores.Store, local *stores.Local, sindex stores.SectorIndex, ret storiface.WorkerReturn, cst *statestore.StateStore) *LocalWorker {
acceptTasks := map[sealtasks.TaskType]struct{}{} acceptTasks := map[sealtasks.TaskType]struct{}{}
for _, taskType := range wcfg.TaskTypes { for _, taskType := range wcfg.TaskTypes {
acceptTasks[taskType] = struct{}{} acceptTasks[taskType] = struct{}{}