Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: Separate the Net interface from Common #6627

Merged
merged 5 commits into from
Jul 22, 2021
Merged

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented Jun 29, 2021

This implements the basic separation of the Net api from CommonAPI, which should make it much easier to construct nodes without it

(this is for #6356, but can be merged separately to reduce PR sizes)

@@ -41,6 +41,7 @@ import (
// StorageMiner is a low-level interface to the Filecoin network storage miner node
type StorageMiner interface {
Common
Net
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have to do this in initial MRA split PR, but ideally:

  • We'd have the miner interface split into more, per service interfaces
  • In the API serve logic we'd only construct the RPC server with the services a node actually supports

node/builder.go Outdated Show resolved Hide resolved
@magik6k magik6k requested review from nonsense and raulk June 29, 2021 12:44
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/storage"
"github.com/filecoin-project/lotus/storage/sectorblocks"
sto "github.com/filecoin-project/specs-storage/storage"
)

type StorageMinerAPI struct {
common.CommonAPI
fx.In
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magik6k why is this necessary now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no longer provided by the embedded structs (which Fx apparently was picking up)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fx.In embeds dig.In, which is a private interface, so if it was embedded in deeper structs, the parent struct would 'inherit' it)

@magik6k magik6k force-pushed the feat/split-net-api branch 2 times, most recently from e2cf25a to 87b1029 Compare July 15, 2021 09:48
Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

api/api_net.go Outdated Show resolved Hide resolved
return a.Host.Network().Connectedness(pid), nil
}

func (a *Libp2pNetAPI) NetPubsubScores(context.Context) ([]api.PubsubScore, error) {
func (a *NetAPI) NetPubsubScores(context.Context) ([]api.PubsubScore, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: it would be nice if the order of methods here matched the order of declarations on the Net interface in api_net.go

api/proxy_util_test.go Show resolved Hide resolved
@magik6k magik6k requested a review from a team as a code owner July 22, 2021 13:38
@magik6k magik6k merged commit 90ad0d8 into master Jul 22, 2021
@magik6k magik6k deleted the feat/split-net-api branch July 22, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants