optimize Settings.nodeType
This commit is contained in:
parent
aa83a4c1f5
commit
45a5eaf913
@ -475,12 +475,18 @@ func Repo(r repo.Repo) Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FullAPI(out *api.FullNode) Option {
|
func FullAPI(out *api.FullNode) Option {
|
||||||
return func(s *Settings) error {
|
return Options(
|
||||||
resAPI := &impl.FullNodeAPI{}
|
func(s *Settings) error {
|
||||||
s.invokes[ExtractApiKey] = fx.Extract(resAPI)
|
s.nodeType = repo.FullNode
|
||||||
*out = resAPI
|
return nil
|
||||||
return nil
|
},
|
||||||
}
|
func(s *Settings) error {
|
||||||
|
resAPI := &impl.FullNodeAPI{}
|
||||||
|
s.invokes[ExtractApiKey] = fx.Extract(resAPI)
|
||||||
|
*out = resAPI
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
type StopFunc func(context.Context) error
|
type StopFunc func(context.Context) error
|
||||||
@ -488,9 +494,8 @@ type StopFunc func(context.Context) error
|
|||||||
// New builds and starts new Filecoin node
|
// New builds and starts new Filecoin node
|
||||||
func New(ctx context.Context, opts ...Option) (StopFunc, error) {
|
func New(ctx context.Context, opts ...Option) (StopFunc, error) {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
modules: map[interface{}]fx.Option{},
|
modules: map[interface{}]fx.Option{},
|
||||||
invokes: make([]fx.Option, _nInvokes),
|
invokes: make([]fx.Option, _nInvokes),
|
||||||
nodeType: repo.FullNode,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply module options in the right order
|
// apply module options in the right order
|
||||||
|
Loading…
Reference in New Issue
Block a user