-
Notifications
You must be signed in to change notification settings - Fork 112
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
go/archive-mode: disable runtime P2P if archive mode is used #4775
Conversation
b46b5a2
to
befd758
Compare
Codecov Report
@@ Coverage Diff @@
## master #4775 +/- ##
==========================================
+ Coverage 66.82% 66.88% +0.05%
==========================================
Files 448 451 +3
Lines 50246 50294 +48
==========================================
+ Hits 33579 33638 +59
- Misses 12492 12495 +3
+ Partials 4175 4161 -14
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work with abstracting out the P2P interface. Some minor comments.
go/oasis-node/cmd/node/node.go
Outdated
if genesisDoc.Registry.Parameters.DebugAllowUnroutableAddresses { | ||
p2p.DebugForceAllowUnroutableAddresses() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unintended, reverted
go/worker/common/p2p/nop.go
Outdated
} | ||
|
||
// NewMock creates a new no-op mock P2P node. | ||
func NewMock() api.Service { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather call it NewNop
(or similar) as mock could imply it is only used in tests as it provides mock responses.
go/worker/common/p2p/nop.go
Outdated
|
||
// Implements api.Service. | ||
func (p *nopP2P) Name() string { | ||
return "mock p2p" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "mock p2p" | |
return "no-op p2p" |
go/worker/common/p2p/nop.go
Outdated
"github.com/oasisprotocol/oasis-core/go/worker/common/p2p/rpc" | ||
) | ||
|
||
// nopP2P is a no-op mock peer-to-peer node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// nopP2P is a no-op mock peer-to-peer node. | |
// nopP2P is a no-op peer-to-peer node that does not propagate anything. |
go/worker/common/p2p/rpc/client.go
Outdated
maxPeerResponseTime time.Duration, | ||
opts ...CallOption, | ||
) (PeerFeedback, error) { | ||
return nil, fmt.Errorf("unsupported: mock p2p") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("unsupported: mock p2p") | |
return nil, fmt.Errorf("unsupported: p2p is disabled") |
go/worker/common/p2p/rpc/client.go
Outdated
maxParallelRequests uint, | ||
opts ...CallMultiOption, | ||
) ([]interface{}, []PeerFeedback, error) { | ||
return nil, nil, fmt.Errorf("unsupported: mock p2p") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, nil, fmt.Errorf("unsupported: mock p2p") | |
return nil, nil, fmt.Errorf("unsupported: p2p is disabled") |
go/worker/common/p2p/rpc/client.go
Outdated
@@ -215,6 +215,33 @@ type Client interface { | |||
) ([]interface{}, []PeerFeedback, error) | |||
} | |||
|
|||
type nopClient struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move the nop client and peer manager into a separate nop.go
.
go/worker/common/p2p/rpc/peermgmt.go
Outdated
@@ -325,6 +353,10 @@ func (mgr *peerManager) peerProtocolWatcher() { | |||
|
|||
// NewPeerManager creates a new peer manager for the given protocol. | |||
func NewPeerManager(p2p P2P, protocolID protocol.ID, stickyPeers bool) PeerManager { | |||
if p2p.GetHost() == nil { | |||
// Mock P2P service, use the mock peer manager. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Mock P2P service, use the mock peer manager. | |
// No P2P service, use the no-op peer manager. |
4bcec27
to
6db6ce7
Compare
6db6ce7
to
80c39d0
Compare
80c39d0
to
2657e28
Compare
No description provided.