Uh oh!
There was an error while loading. Please reload this page.
proto: initial protobuf for config - #185
Conversation
laijs
commented
Sep 15, 2015
Don't put a refactor patch which refactors another patch inside the same pr. |
vbatts
commented
Sep 15, 2015
@laijs eh? |
laijs
commented
Sep 15, 2015
I found you pr has a style-related patch and an indent patch, they are applied for an earlier patch in the same pr, it is bad, the earlier patch should be updated directly to resolve these problem. |
vbatts
commented
Sep 15, 2015
Oh I see, I'll flatten the indentation fixes. Not sure why that wasn't
|
To have a less source based, and more consumable example of structures, this is an initial pass at protobuf structures for the structures in the specs golang source. There is some exercise needed in platform specific structures. For the sake of example, the Makefile defaults to outputing golang source, but has a 'c' target (`make c`) for C source, a `make py` and `make all` target. This User structure does not map to the cleanliness of the current go structure, but will allow the definition to be all in one place, regardless of the host that is doing the compilation. All field rules to `optional` for now. Per vish and the docs, https://developers.google.com/protocol-buffers/docs/proto?csw=1#specifying-field-rules "! Required Is Forever" There are a couple of concessions, but is pretty much lined up. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
https://developers.google.com/protocol-buffers/docs/style?hl=en Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Let the user decide the value. opencontainers#179 (comment) Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
per opencontainers#179 (comment) Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
vbatts
commented
Sep 15, 2015
@laijs I squashed some and moved the indentation fixes to the initial commit |
philips
commented
Sep 24, 2015
The idea is that we use protobuf 3 JSON encodings? Update: this is what I mean by protobuf encoding: https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json |
vbatts
commented
Sep 24, 2015
https://github.com/google/protobuf/releases/tag/v3.0.0-beta-1 beta was only 28 days ago... |
vbatts
commented
Sep 24, 2015
@philips here is the output with this most recent push: |
mrunalp
commented
Sep 24, 2015
@vbatts The json looks good 👍 |
Now the default make target shows json output from the example.go source. Consolidated the protobuf files due to a cyclic import issue. Cleaned up outputs to source respective outputs directories. Added a `cpp` target. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
wking
commented
Sep 26, 2015
On Thu, Sep 24, 2015 at 10:21:17AM -0700, Brandon Philips wrote:
I've pushed some work along this lines to vbatts#2, which turns I've also pushed some proto2 work fleshing out Process to I'll leave it there for now, but I'm happy to help push this forward |
wking
commented
Sep 27, 2015
On Sat, Sep 26, 2015 at 01:12:07PM -0700, W. Trevor King wrote:
One way around the Any+Go issue is to use C++ instead of Go ;), so |
vbatts
commented
Sep 28, 2015
one approach that could work, regardless of protobuf, but could facilitate this kind of multi-platform accommodation, would be to have the canonical configuration be |
conqerAtapple
commented
Sep 28, 2015
How about concept of overlaid configurations? -jojy
|
wking
commented
Sep 28, 2015
On Mon, Sep 28, 2015 at 08:30:23AM -0700, Jojy George Varghese wrote:
Previous discussion along these lines in #73, #74, and #76. My |
wking
commented
Sep 28, 2015
On Mon, Sep 28, 2015 at 07:51:04AM -0700, Vincent Batts wrote:
I don't think that works for multi-platform bundles. For example, If you're just suggesting it as a way to work around the platform.user |
conqerAtapple
commented
Sep 28, 2015
Thanks for the history Trevor. If there has to be a way to "include" other configs to form a configuration "union", shouldnt there be a spec so that its uniform and unambiguous? -jojy
|
wking
commented
Sep 28, 2015
On Mon, Sep 28, 2015 at 09:48:43AM -0700, Jojy George Varghese wrote:
I think this is getting pretty off-topic for “what do we think about |
vbatts
commented
Sep 28, 2015
@conqer I tried this, but when importing, it added to the golang source an |
bufdev
commented
Oct 24, 2015
Just as an interested observer, I'd highly recommend going with proto3 syntax, the beta was only 28 days ago but it's pretty highly stable and used in production (and gRPC is really good). Some things that might help: go.pedge.io/google-protobuf - takes care of $(which protoc)/../include/google/protobuf files Let me know if I can be of help. |
* a more field out config structure * display using the jsonpb library * display the binary proto message Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
vbatts
commented
Dec 11, 2015
@peter-edge thanks for the pointers. |
bufdev
commented
Dec 11, 2015
I did this recently too: https://github.com/peter-edge/go-protoeasy |
vbatts
commented
Dec 14, 2015
Further updates on this protobuf. One thing that I am not entirely certain about, is the ability to have variation in the fields of a message. For example, if there is the ability to introduce new fields in a message type, such that did not conflict with prior versions of the message type. Would decoders of the prior version of the message type decode only the fields known it its version? Hopefully that question is clear enough. |
bufdev
commented
Dec 14, 2015
Yes, that's basically half the point of protobuf, and why a lot of people use it :) Let me see if I can find some docs to explain better. |
bufdev
commented
Dec 14, 2015
Actually https://developers.google.com/protocol-buffers/docs/overview explains it a little at the bottom in the "A bit of history" section. Most protocol buffer language implementations have the notion of unrecognized fields, that is fields that given the definition of a message it has, do not have matching tag numbers. When you edit a protocol buffer message, you only ever add fields, and if you do want to delete fields, the general pattern is you always use an increasing field number for new fields, to avoid ever reusing old field numbers. |
bufdev
commented
Dec 14, 2015
Two other things:
|
vbatts
commented
Dec 16, 2015
I'm increasingly of the mind that going the route of protobuf is too much a hammer-looking-for-a-nail. I think this needs a step back, to solve the actual problem of implementation independent reference and schema. |
mrunalp
commented
Dec 16, 2015
I agree. Sent from my iPhone
|
duglin
commented
Dec 16, 2015
I tend to agree. Going away from other, simple, choices like json, yml (or heck even xml) feels really odd to me. |
bufdev
commented
Dec 16, 2015
Just the minority opinion here: Protobufs make dev life way nicer once you figure it out. Really the auto-generation of what amount to DTO objects is enough for a huge win - once you start using them, a lot of code that would otherwise not be easy to document or would be inconsistent is suddenly just generated. Compiling etc is very easy once you understand it. |
LK4D4
commented
Dec 16, 2015
@peter-edge I agree that code-generation is a huge plus. I tried myself and schema much more convenient than json, apart from human-readability of the ready spec itself. |
bufdev
commented
Dec 16, 2015
Protobufs have a lot of other wins too:
|
bufdev
commented
Dec 16, 2015
Another instructive example: here's the docker volume API as a protobuf service, generated to grpc and grpc-gateway golang code: https://github.com/peter-edge/go-dockervolume/blob/master/dockervolume.proto |
vbatts
commented
Jan 13, 2016
Closing this. The specification of the configuration file is a json schema question. Even #276 moves in this direction, by having the golang source being a reference to achieve the desired structures. See also #306 |
To have a less source based, and more consumable example of structures,
this is an initial pass at protobuf structures for the structures from all the current golang source.
There is some exercise needed in platform specific structures.
The
Makefiledefaults to golang source output, but also has actarget for C source andpytarget for python as well.Signed-off-by: Vincent Batts vbatts@hashbangbash.com