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

Introduce protobuf types under new pkg directory #56

Merged
merged 15 commits into from
Mar 27, 2018
Merged
Prev Previous commit
Next Next commit
Add protobuf dependency with dep.
This was initalized by running `dep init` in the `pkg` directory.
Of note, this duplicates our vendored dependencies between `go/` and
`pkg/`, but for all intents and purposes, they are separate.
Raghav Gulati committed Mar 26, 2018

Unverified

No user is associated with the committer email.
commit 62b803818a385f9d68466aad8b173dd5f60723fd
15 changes: 15 additions & 0 deletions pkg/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions pkg/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/gogo/protobuf"
version = "1.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

From a glance at gogo/protobuf, most of its changes are in golang/protobuf. Was there something specific that you wanted from them? I would rather depend on the upstream if possible.

Notably, we'll need to fork this to Keep as well… But we'll hold off for now.

Also, remember to depend on a commit id, not a tag. Tags are mutable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you point where most of gogo/protobuf's features are in golang/protobuf? I know it's definitely the other way around, but not seeing evidence that golang/protobuf has gogo's fast marshalling + unmarshalling (this issue does a great job of detailing why folks use gogo: golang/protobuf#280), other serialization formats (grpc, json if we need to switch / test things out), and more canonical go structures (figures a fork has better go support than the original). That being said, as things change, we should definitely evaluate them. Folks in the industry focused on performance have gravitated around gogo's solution. As we'll be having a lot of chatter on the wire, we'll want the one that's most supported and optimized for our use case.

Will change to commit id - thanks for catching that (why oh why dep do you default to tags)

Copy link
Contributor Author

@rargulati rargulati Mar 26, 2018

Choose a reason for hiding this comment

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

Here is the tradeoff that you end up making: https://groups.google.com/forum/#!msg/golang-nuts/F5xFHTfwRnY/sPv5nTVXBQAJ (this is the go teams opinion of the tradeoff).

From past use, the un/marshallers in gogo are super helpful. Writing that code can be annoying, and it's one of the few times that I'm a fan of code generation.

Do you think the tradeoffs that we will need to make in relay/Keep land are more around speed/performance or size?

Copy link
Contributor

Choose a reason for hiding this comment

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

Tbh I'm pretty concerned with the forward-compatibility changes the gogo representative says they haven't dealt with… It sounds like it's a young project used by young projects, and that usually means tradeoffs that haven't been fully understood. I trust the Google folks to understand problems like that a bit better.

My initial understanding was wrong here though: gogo/protobuf#191 was what I based my comment on, and it tracks the opposite of what I thought, namely whether the mainline has been merged into this fork.

I suspect our performance will be absolutely dominated by almost everything except serialization/deserialization, since our data structures right now aren't terribly complicated or large, and though we'll have chatter it won't be super-frequent. Given the emphasis on compatibility, I'm tempted to say we stick with golang's version and switch to gogo if and when we find ourselves with problems it tackles in a way we think is good.

Lastly, re: marshaller/unmarshaller, presumably the golang version has that as well, it's just not repeated for each type? So it's not like we have no insight into how it's doing things, right?

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 see where you're coming from, but I need to respectfully disagree on a few points here:

Given the number of users (including dropbox, docker, and redhat), and even our friends in decentra-land are in the game! https://github.com/ipfs/go-ipfs/search?utf8=%E2%9C%93&q=gogo&type=

I'd say there are good reasons for using it! That being said, you bring up a great point about us being dominated by other issues before serialization becomes a concern. That being said, if we're shipping BLS ids and group signature shares around, I think we'll be contending with these issues as well...

Re confusion over gogo becoming compatible with golang/protobuf: they're working on merging mainline back in - I think that's a good thing in terms of giving us options.

Copy link
Contributor

Choose a reason for hiding this comment

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

More importantly it looks like libp2p uses it, so I think we'll be pulling the dependency in transitively anyway, and therefore I guess we'll need to pin it regardless. I don't love it, and I continue to be more convinced by upstream's arguments more than downstream's, but so it goes. Let's do whatever minimizes the cross-section of packages we need to pin, in this case that looks like it's sticking to gogo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, for personal curiosity, off-thread I'd love to hear your explanation of upstream's arguments vs downstream's args. I might be missing something here.


[prune]
go-tests = true
unused-packages = true