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

satellite,storagenode,bootstrap: add contact service to peer #2951

Merged
merged 2 commits into from
Sep 4, 2019

Conversation

thepaul
Copy link
Contributor

@thepaul thepaul commented Sep 4, 2019

What:

Adds contact services and endpoints as necessary to satellite and storagenode.

Why:

We will need these once we remove kademlia.

Please describe the tests:

  • There is not really any new behavior to test right now; if anything works at all once we start using these facilities, then this change works.

Please describe the performance impact:

None

Code Review Checklist (to be filled out by reviewer)

  • Does the PR describe what changes are being made?
  • Does the PR describe why the changes are being made?
  • Does the code follow our style guide?
  • Does the code follow our testing guide?
  • Is the PR appropriately sized? (If it could be broken into smaller PRs it should be)
  • Does the new code have enough tests? (every PR should have tests or justification otherwise. Bug-fix PRs especially)
  • Does the new code have enough documentation that answers "how do I use it?" and "what does it do?"? (both source documentation and higher level, diagrams?)
  • Does any documentation need updating?
  • Do the database access patterns make sense?

@thepaul thepaul added Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR labels Sep 4, 2019
@thepaul thepaul requested review from jenlij, JessicaGreben, cam-a and a team September 4, 2019 18:36
@cla-bot cla-bot bot added the cla-signed label Sep 4, 2019
@ghost ghost removed their request for review September 4, 2019 18:37
@@ -352,6 +357,11 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
pb.RegisterKadInspectorServer(peer.Server.PrivateGRPC(), peer.Kademlia.Inspector)
}

{ // setup contact service
log.Debug("Setting up contact service")
peer.Contact.Service = contact.NewService(peer.Log.Named("contact"), peer.Overlay.Service, peer.Transport)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need an endpoint for the SA peer as well that has the contact.PingNode() rpc?

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 so. I'm worried if we did that, that it would be confusing for PingNode to be serviced by contact.Service on the nodes and contact.Service on the satellites, but where those two contact.Service's are totally different things :/

Copy link
Contributor

Choose a reason for hiding this comment

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

lol. im confused. ok well lets merge this and sort it out in my next ticket.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh. I mean, cause, storagenode/contact.Service (or Endpoint) and satellite/contact.Service (or Endpoint) are totally different things

@@ -76,6 +77,11 @@ type Peer struct {
Inspector *kademlia.Inspector
}

Contact struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not according to the linter, and not according to current practice (see the other nearby structs). But we could sure add one if it is needed for readability

Copy link
Contributor

Choose a reason for hiding this comment

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

no need to add one, i just thought the linter would complain

@@ -20,7 +20,7 @@ var mon = monkit.Package()
// Service is the contact service between storage nodes and satellites
type Service struct {
log *zap.Logger
self *overlay.NodeDossier
self overlay.NodeDossier
Copy link
Contributor

Choose a reason for hiding this comment

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

just out of curiosity why make this a value instead of a pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solely for the sake of being able to pass the result of peer.Kademlia.RoutingTable.Local() into the NewService constructor. But also, it looks like that's how we generally pass these around. We don't need it to be a pointer (it doesn't need to be changed from elsewhere), and the overhead of copying the extra bytes for copy-by-value is probably outweighed by the overhead of gc stuff when we use a pointer.

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that too... I bet it's so this service doesn't accidentally overwrite any of the nodeDossier data

JessicaGreben
JessicaGreben previously approved these changes Sep 4, 2019
jenlij
jenlij previously approved these changes Sep 4, 2019
bootstrap doesn't have an overlay.
@thepaul thepaul dismissed stale reviews from jenlij and JessicaGreben via 8caef66 September 4, 2019 18:51
@cam-a cam-a merged commit 9821a21 into master Sep 4, 2019
@cam-a cam-a deleted the purple/hook-up-contact-service branch September 4, 2019 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants