wip remote sectorbuilder workers

This commit is contained in:
Łukasz Magiera
2019-11-21 01:53:06 +01:00
parent 6b36f19a9d
commit 9725eb78bf
9 changed files with 485 additions and 65 deletions
+5
View File
@@ -66,6 +66,11 @@ type StorageMiner interface {
SectorsRefs(context.Context) (map[string][]SealedRef, error)
WorkerStats(context.Context) (WorkerStats, error)
// WorkerQueue registers a remote worker
WorkerQueue(context.Context) (<-chan sectorbuilder.WorkerTask, error)
WorkerDone(ctx context.Context, task uint64, res sectorbuilder.SealRes) error
}
type WorkerStats struct {
+12
View File
@@ -2,6 +2,7 @@ package api
import (
"context"
"github.com/filecoin-project/lotus/lib/sectorbuilder"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/network"
@@ -141,6 +142,9 @@ type StorageMinerStruct struct {
SectorsRefs func(context.Context) (map[string][]SealedRef, error) `perm:"read"`
WorkerStats func(context.Context) (WorkerStats, error) `perm:"read"`
WorkerQueue func(context.Context) (<-chan sectorbuilder.WorkerTask, error) `perm:"admin"` // TODO: worker perm
WorkerDone func(ctx context.Context, task uint64, res sectorbuilder.SealRes) error `perm:"admin"`
}
}
@@ -522,6 +526,14 @@ func (c *StorageMinerStruct) WorkerStats(ctx context.Context) (WorkerStats, erro
return c.Internal.WorkerStats(ctx)
}
func (c *StorageMinerStruct) WorkerQueue(ctx context.Context) (<-chan sectorbuilder.WorkerTask, error) {
return c.Internal.WorkerQueue(ctx)
}
func (c *StorageMinerStruct) WorkerDone(ctx context.Context, task uint64, res sectorbuilder.SealRes) error {
return c.Internal.WorkerDone(ctx, task, res)
}
var _ Common = &CommonStruct{}
var _ FullNode = &FullNodeStruct{}
var _ StorageMiner = &StorageMinerStruct{}