workers: Address review
This commit is contained in:
parent
df9aa0e357
commit
d43f2a2e3b
@ -137,11 +137,11 @@ func main() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
/*defer func() {
|
||||
defer func() {
|
||||
if err := os.RemoveAll(tsdir); err != nil {
|
||||
log.Warn("remove all: ", err)
|
||||
}
|
||||
}()*/
|
||||
}()
|
||||
sbdir = tsdir
|
||||
} else {
|
||||
exp, err := homedir.Expand(robench)
|
||||
|
@ -49,7 +49,7 @@ func main() {
|
||||
Version: build.UserVersion,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "workerrepo",
|
||||
Name: FlagStorageRepo,
|
||||
EnvVars: []string{"WORKER_PATH"},
|
||||
Value: "~/.lotusworker", // TODO: Consider XDG_DATA_HOME
|
||||
},
|
||||
@ -261,7 +261,7 @@ var runCmd = &cli.Command{
|
||||
log.Warn("Graceful shutdown successful")
|
||||
}()
|
||||
|
||||
nl, err := net.Listen("tcp4", cctx.String("address"))
|
||||
nl, err := net.Listen("tcp", cctx.String("address"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -135,27 +135,37 @@ var storageListCmd = &cli.Command{
|
||||
}
|
||||
|
||||
for id, sectors := range st {
|
||||
var u, s, c int
|
||||
var cnt [3]int
|
||||
for _, decl := range sectors {
|
||||
if decl.SectorFileType§orbuilder.FTUnsealed > 0 {
|
||||
u++
|
||||
for i := range cnt {
|
||||
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("\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)
|
||||
if err != nil {
|
||||
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 {
|
||||
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())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sid := abi.SectorID{
|
||||
|
@ -266,7 +266,7 @@ func Online() Option {
|
||||
ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
|
||||
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(dtypes.MinerID), modules.MinerID),
|
||||
Override(new(dtypes.MinerAddress), modules.MinerAddress),
|
||||
|
Loading…
Reference in New Issue
Block a user