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

Improvement/refactor discovery related stuff #610

Merged
merged 5 commits into from
Dec 12, 2018

Conversation

tadovas
Copy link
Contributor

@tadovas tadovas commented Dec 11, 2018

One biggest pains, which asked for refactoring:

  1. Splitted global MysteriumClient interface into small ones and moved to callers - no more dependencies to mysterium client which is renamed to mysterium api (access to our central discovery service)
  2. Introduced market package with subpackages - top root package defines proposal related stuff (all shared structures like Proposal, Location, Service and so on), concrete functionalities have own subpackages (metrics, central api access, proposal lifecycle component)
  3. Basically a lot of files touched because of proposal moving to different package

Bonus: almost all packages are golint'ed :)

Question: which sounds better? proposals.ServiceProposal or market.ServiceProposal ? In second case I will move proposals up one package (to market)

@tadovas tadovas force-pushed the improvement/refactor-discovery-related-stuff branch 5 times, most recently from e24643b to 8033754 Compare December 11, 2018 17:53
cmd/di.go Outdated
@@ -70,7 +70,7 @@ type Dependencies struct {
Node *node.Node

NetworkDefinition metadata.NetworkDefinition
MysteriumClient server.Client
MysteriumApi *mysterium.MysteriumApi
Copy link
Member

Choose a reason for hiding this comment

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

Can we call it MysteriumAPI to follow https://github.com/golang/go/wiki/CodeReviewComments#initialisms and keep acronyms in the consistent case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@@ -50,22 +49,23 @@ func newHTTPTransport(requestTimeout time.Duration) HTTPTransport {
}
}

type mysteriumAPI struct {
// MysteriumApi provides access to mysterium owned central discovery service
type MysteriumApi struct {
Copy link
Member

Choose a reason for hiding this comment

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

type MysteriumApi should be MysteriumAPI (golint)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 fixed

@tadovas tadovas force-pushed the improvement/refactor-discovery-related-stuff branch from 8033754 to 8039578 Compare December 12, 2018 07:18
@zolia
Copy link
Contributor

zolia commented Dec 12, 2018

I would say market.ServiceProposal sounds better.

if f() {
return nil
}
func waitForChannel(ch chan bool, duration time.Duration) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could have this as a general function somewhere in utils.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably. But not worth it at the moment.

@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// Tequila API
// Package tequilapi Tequila API
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a proper description here since we're already changing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you call proper description? This change was made to make golint happy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something along the lines of Package tequilapi contains the Tequila API http server as well as a client for interacting with it

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 wonder how it look in swagger docs. As this first line is important for godoc and for swagger too.

@tadovas tadovas force-pushed the improvement/refactor-discovery-related-stuff branch 2 times, most recently from 3adc734 to c5ce19e Compare December 12, 2018 07:58
@tadovas tadovas force-pushed the improvement/refactor-discovery-related-stuff branch from c5ce19e to 9b018fb Compare December 12, 2018 08:00
Copy link
Contributor

@zolia zolia left a comment

Choose a reason for hiding this comment

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

lgtm

@tadovas tadovas merged commit 6ca92c6 into master Dec 12, 2018
@tadovas tadovas deleted the improvement/refactor-discovery-related-stuff branch December 12, 2018 08:54
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.

4 participants