start integrating sector builder
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/filecoin-project/go-lotus/chain/store"
|
||||
"github.com/filecoin-project/go-lotus/chain/types"
|
||||
"github.com/filecoin-project/go-lotus/chain/wallet"
|
||||
"github.com/filecoin-project/go-lotus/lib/sectorbuilder"
|
||||
"github.com/filecoin-project/go-lotus/node/config"
|
||||
"github.com/filecoin-project/go-lotus/node/hello"
|
||||
"github.com/filecoin-project/go-lotus/node/impl"
|
||||
@@ -246,6 +247,11 @@ func Config(cfg *config.Root) Option {
|
||||
ApplyIf(func(s *Settings) bool { return s.Online },
|
||||
Override(StartListeningKey, lp2p.StartListening(cfg.Libp2p.ListenAddresses)),
|
||||
),
|
||||
|
||||
ApplyIf(func(s *Settings) bool { return s.nodeType == nodeStorageMiner },
|
||||
Override(new(*sectorbuilder.SectorBuilderConfig), modules.SectorBuilderConfig),
|
||||
Override(new(*sectorbuilder.SectorBuilder), sectorbuilder.New),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@ package impl
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/lib/sectorbuilder"
|
||||
)
|
||||
|
||||
type StorageMinerAPI struct {
|
||||
CommonAPI
|
||||
|
||||
SectorBuilder *sectorbuilder.SectorBuilder
|
||||
}
|
||||
|
||||
var _ api.StorageMiner = &StorageMinerAPI{}
|
||||
|
||||
@@ -30,8 +30,10 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/chain/address"
|
||||
"github.com/filecoin-project/go-lotus/chain/store"
|
||||
"github.com/filecoin-project/go-lotus/chain/types"
|
||||
"github.com/filecoin-project/go-lotus/lib/sectorbuilder"
|
||||
"github.com/filecoin-project/go-lotus/node/modules/helpers"
|
||||
"github.com/filecoin-project/go-lotus/node/repo"
|
||||
)
|
||||
@@ -216,3 +218,23 @@ func LoadGenesis(genBytes []byte) func(blockstore.Blockstore) Genesis {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func SectorBuilderConfig(storagePath string) (*sectorbuilder.SectorBuilderConfig, error) {
|
||||
metadata := filepath.Join(storagePath, "meta")
|
||||
sealed := filepath.Join(storagePath, "sealed")
|
||||
staging := filepath.Join(storagePath, "staging")
|
||||
|
||||
// TODO: get the address of the miner actor
|
||||
minerAddr, err := address.NewIDAddress(42)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return §orbuilder.SectorBuilderConfig{
|
||||
Miner: minerAddr,
|
||||
SectorSize: 1024,
|
||||
MetadataDir: metadata,
|
||||
SealedDir: sealed,
|
||||
StagedDir: staging,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user