Skip to content

Commit

Permalink
config: extract DealmakingConfig and Sealing config from Lotus for Bo…
Browse files Browse the repository at this point in the history
…ost (#8172)

* refactor sealingCfg and dealmakingCfg to be able to abstract Config

* fix error messages
  • Loading branch information
nonsense committed Mar 3, 2022
1 parent 066d0ed commit acbfc87
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 80 deletions.
4 changes: 2 additions & 2 deletions cli/util/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
}
}

return APIInfo{}, fmt.Errorf("could not determine API endpoint for node type: %v", t)
return APIInfo{}, fmt.Errorf("could not determine API endpoint for node type: %v", t.Type())
}

func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http.Header, error) {
ainfo, err := GetAPIInfo(ctx, t)
if err != nil {
return "", nil, xerrors.Errorf("could not get API info for %s: %w", t, err)
return "", nil, xerrors.Errorf("could not get API info for %s: %w", t.Type(), err)
}

addr, err := ainfo.DialArgs(version)
Expand Down
2 changes: 1 addition & 1 deletion itests/sector_finalize_early_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestDealsWithFinalizeEarly(t *testing.T) {
return func() (sealiface.Config, error) {
cf := config.DefaultStorageMiner()
cf.Sealing.FinalizeEarly = true
return modules.ToSealingConfig(cf), nil
return modules.ToSealingConfig(cf.Dealmaking, cf.Sealing), nil
}, nil
})))) // no mock proofs.
ens.InterconnectAll().BeginMining(blockTime)
Expand Down
16 changes: 16 additions & 0 deletions node/config/doc_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions node/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ type StorageMiner struct {
DAGStore DAGStoreConfig
}

type DealmakingConfiger interface {
GetDealmakingConfig() DealmakingConfig
SetDealmakingConfig(DealmakingConfig)
}

func (c *StorageMiner) GetDealmakingConfig() DealmakingConfig {
return c.Dealmaking
}

func (c *StorageMiner) SetDealmakingConfig(other DealmakingConfig) {
c.Dealmaking = other
}

type SealingConfiger interface {
GetSealingConfig() SealingConfig
SetSealingConfig(SealingConfig)
}

func (c *StorageMiner) GetSealingConfig() SealingConfig {
return c.Sealing
}

func (c *StorageMiner) SetSealingConfig(other SealingConfig) {
c.Sealing = other
}

type DAGStoreConfig struct {
// Path to the dagstore root directory. This directory contains three
// subdirectories, which can be symlinked to alternative locations if
Expand Down
Loading

0 comments on commit acbfc87

Please sign in to comment.