workers: Address review
This commit is contained in:
parent
df9aa0e357
commit
d43f2a2e3b
@ -137,11 +137,11 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
/*defer func() {
|
defer func() {
|
||||||
if err := os.RemoveAll(tsdir); err != nil {
|
if err := os.RemoveAll(tsdir); err != nil {
|
||||||
log.Warn("remove all: ", err)
|
log.Warn("remove all: ", err)
|
||||||
}
|
}
|
||||||
}()*/
|
}()
|
||||||
sbdir = tsdir
|
sbdir = tsdir
|
||||||
} else {
|
} else {
|
||||||
exp, err := homedir.Expand(robench)
|
exp, err := homedir.Expand(robench)
|
||||||
|
@ -49,7 +49,7 @@ func main() {
|
|||||||
Version: build.UserVersion,
|
Version: build.UserVersion,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "workerrepo",
|
Name: FlagStorageRepo,
|
||||||
EnvVars: []string{"WORKER_PATH"},
|
EnvVars: []string{"WORKER_PATH"},
|
||||||
Value: "~/.lotusworker", // TODO: Consider XDG_DATA_HOME
|
Value: "~/.lotusworker", // TODO: Consider XDG_DATA_HOME
|
||||||
},
|
},
|
||||||
@ -261,7 +261,7 @@ var runCmd = &cli.Command{
|
|||||||
log.Warn("Graceful shutdown successful")
|
log.Warn("Graceful shutdown successful")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
nl, err := net.Listen("tcp4", cctx.String("address"))
|
nl, err := net.Listen("tcp", cctx.String("address"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -135,27 +135,37 @@ var storageListCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for id, sectors := range st {
|
for id, sectors := range st {
|
||||||
var u, s, c int
|
var cnt [3]int
|
||||||
for _, decl := range sectors {
|
for _, decl := range sectors {
|
||||||
if decl.SectorFileType§orbuilder.FTUnsealed > 0 {
|
for i := range cnt {
|
||||||
u++
|
if decl.SectorFileType&(1<<i) != 0 {
|
||||||
}
|
cnt[i]++
|
||||||
if decl.SectorFileType§orbuilder.FTSealed > 0 {
|
}
|
||||||
s++
|
|
||||||
}
|
|
||||||
if decl.SectorFileType§orbuilder.FTCache > 0 {
|
|
||||||
c++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%s:\n", id)
|
fmt.Printf("%s:\n", id)
|
||||||
fmt.Printf("\tUnsealed: %d; Sealed: %d; Caches: %d\n", u, s, c)
|
fmt.Printf("\tUnsealed: %d; Sealed: %d; Caches: %d\n", cnt[0], cnt[1], cnt[2])
|
||||||
|
|
||||||
si, err := nodeApi.StorageInfo(ctx, id)
|
si, err := nodeApi.StorageInfo(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("\tSeal: %t; Store: %t; Weight: %d\n", si.CanSeal, si.CanStore, si.Weight)
|
|
||||||
|
fmt.Print("\t")
|
||||||
|
if si.CanSeal || si.CanStore {
|
||||||
|
fmt.Printf("Weight: %d; Use: ", si.Weight)
|
||||||
|
if si.CanSeal {
|
||||||
|
fmt.Print("Seal ")
|
||||||
|
}
|
||||||
|
if si.CanStore {
|
||||||
|
fmt.Print("Store")
|
||||||
|
}
|
||||||
|
fmt.Println("")
|
||||||
|
} else {
|
||||||
|
fmt.Println("Use: ReadOnly")
|
||||||
|
}
|
||||||
|
|
||||||
if localPath, ok := local[id]; ok {
|
if localPath, ok := local[id]; ok {
|
||||||
fmt.Printf("\tLocal: %s\n", localPath)
|
fmt.Printf("\tLocal: %s\n", localPath)
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func (rpn *retrievalProviderNode) UnsealSector(ctx context.Context, sectorID uin
|
|||||||
|
|
||||||
mid, err := address.IDFromAddress(rpn.miner.Address())
|
mid, err := address.IDFromAddress(rpn.miner.Address())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
sid := abi.SectorID{
|
sid := abi.SectorID{
|
||||||
|
@ -266,7 +266,7 @@ func Online() Option {
|
|||||||
ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
|
ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
|
||||||
Override(new(api.Common), From(new(common.CommonAPI))),
|
Override(new(api.Common), From(new(common.CommonAPI))),
|
||||||
|
|
||||||
Override(new(*stores.Index), stores.NewIndex()),
|
Override(new(*stores.Index), stores.NewIndex),
|
||||||
Override(new(stores.SectorIndex), From(new(*stores.Index))),
|
Override(new(stores.SectorIndex), From(new(*stores.Index))),
|
||||||
Override(new(dtypes.MinerID), modules.MinerID),
|
Override(new(dtypes.MinerID), modules.MinerID),
|
||||||
Override(new(dtypes.MinerAddress), modules.MinerAddress),
|
Override(new(dtypes.MinerAddress), modules.MinerAddress),
|
||||||
|
Loading…
Reference in New Issue
Block a user