lotus/api/api_worker.go

47 lines
921 B
Go
Raw Normal View History

2020-03-11 01:57:52 +00:00
package api
import (
"context"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/build"
2020-03-23 11:40:02 +00:00
"github.com/filecoin-project/lotus/storage/sectorstorage/sealtasks"
"github.com/filecoin-project/lotus/storage/sectorstorage/stores"
2020-03-11 01:57:52 +00:00
)
type WorkerApi interface {
Version(context.Context) (build.Version, error)
// TODO: Info() (name, ...) ?
2020-03-23 11:40:02 +00:00
TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error) // TaskType -> Weight
2020-03-13 11:59:19 +00:00
Paths(context.Context) ([]stores.StoragePath, error)
2020-03-20 22:30:17 +00:00
Info(context.Context) (WorkerInfo, error)
2020-03-11 01:57:52 +00:00
storage.Sealer
}
2020-03-20 22:30:17 +00:00
type WorkerResources struct {
MemPhysical uint64
MemSwap uint64
MemReserved uint64 // Used by system / other processes
GPUs []string
}
type WorkerInfo struct {
Hostname string
Resources WorkerResources
}
2020-03-23 14:56:22 +00:00
type WorkerStats struct {
Info WorkerInfo
MemUsedMin uint64
MemUsedMax uint64
GpuUsed bool
CpuUse int
}