storageminer: Config for local worker task types

This commit is contained in:
Łukasz Magiera
2020-03-24 20:38:00 +01:00
parent 62cf9a5dd7
commit 5de17e903c
5 changed files with 27 additions and 10 deletions
+5 -1
View File
@@ -382,7 +382,11 @@ func ConfigStorageMiner(c interface{}) Option {
return Error(xerrors.Errorf("invalid config from repo, got: %T", c))
}
return Options(ConfigCommon(&cfg.Common))
return Options(
ConfigCommon(&cfg.Common),
Override(new(config.Storage), cfg.Storage),
)
}
func Repo(r repo.Repo) Option {
+9 -1
View File
@@ -53,6 +53,10 @@ type Metrics struct {
// // Storage Miner
type Storage struct {
// Local worker config
AllowPreCommit1 bool
AllowPreCommit2 bool
AllowCommit bool
}
func defCommon() Common {
@@ -86,7 +90,11 @@ func DefaultStorageMiner() *StorageMiner {
cfg := &StorageMiner{
Common: defCommon(),
Storage: Storage{},
Storage: Storage{
AllowPreCommit1: true,
AllowPreCommit2: true,
AllowCommit: true,
},
}
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
return cfg
+3 -2
View File
@@ -44,6 +44,7 @@ import (
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/markets/retrievaladapter"
"github.com/filecoin-project/lotus/miner"
"github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/modules/helpers"
"github.com/filecoin-project/lotus/node/repo"
@@ -338,8 +339,8 @@ func RetrievalProvider(h host.Host, miner *storage.Miner, sealer sectorstorage.S
return retrievalimpl.NewProvider(address, adapter, network, pieceStore, ibs, ds)
}
func SectorStorage(mctx helpers.MetricsCtx, lc fx.Lifecycle, ls stores.LocalStorage, si stores.SectorIndex, cfg *sectorbuilder.Config, urls sectorstorage.URLs, ca lapi.Common) (*sectorstorage.Manager, error) {
func SectorStorage(mctx helpers.MetricsCtx, lc fx.Lifecycle, ls stores.LocalStorage, si stores.SectorIndex, cfg *sectorbuilder.Config, sc config.Storage, urls sectorstorage.URLs, ca lapi.Common) (*sectorstorage.Manager, error) {
ctx := helpers.LifecycleCtx(mctx, lc)
return sectorstorage.New(ctx, ls, si, cfg, urls, ca)
return sectorstorage.New(ctx, ls, si, cfg, sc, urls, ca)
}