Open chrislusf opened 8 years ago
i was using protocol buffers (PB) and recently started to use FlatBuffers (FB) for perf reasons. FB is the successor to PB that has been in the alpha oven for a while now, but is now ready (IMHO)
http://google.github.io/flatbuffers/
if seems a good match this Glow, and i am curious on your thoughts. There is no reflection, but instead the go files are code generated at compile time. There is no heap if used correctly at runtime.
I also liked the ability to serialise between FB and JSON. This allows the data types to be reused in the any web layer for a application.
Protocol Buffer or Flat Buffer need definition and code generation. They could be used to customize ser/de.
The default ser/de should not need any additional steps.
ok. I need to look into the code to see how your doing it. I guess its reflection based ?
Fyi: The package was renamed to netchan
:
https://github.com/chrislusf/glow/blob/master/netchan/channels.go#L52
https://github.com/chrislusf/glow/blob/master/netchan/channels.go#L77
if you really want to use DeDiS/protobuf, maybe write a func EncodeValue(value reflect.Value) to wrap from L51~L57 https://github.com/dedis/protobuf/blob/master/encode.go#L51 and write another func (dec *Decoder) DecodeValue(v reflect.Value) to wrap L64 https://github.com/dedis/protobuf/blob/master/decode.go#L64
The affected code is only within this file:
https://github.com/chrislusf/glow/blob/master/io/channels.go#L77
and
https://github.com/chrislusf/glow/blob/master/io/channels.go#L54
I tried to use github.com/DeDiS/protobuf, but it can not handle reflect.Value.