[erlang-questions] [ANN] new erlang protocol buffer project

Jeremy Ong jeremy@REDACTED
Wed May 1 03:56:24 CEST 2013


https://github.com/jeremyong/eprotoc

At Quark Games, we leverage protocol buffers to transfer state between
server and client and back and also use it to encode data when storing
it on the database. The main advantages it gives are an easy to use,
contractual way to send and receive data between many different
languages and domains. For more on protocol buffers:
https://developers.google.com/protocol-buffers/

The problem with many existing libraries is the use of records, which
make it very difficult to use protocol buffers in this way (not easily
shared between modules, not resilient to code upgrades). Protocol
buffers themselves are designed to fluidly transition to new versions
of the same message. Other alternatives do much more than just handle
protocol buffers so they weren't a great fit either. So, in light of
this, I wrote my own library.

The README will hopefully give an idea of where I am going with this.
Given a message like

package Foo;

message Bar {
    required uint32 zap = 1;
}

eprotoc will generate functions like

fun g_zap/1,
fun s_zap/1,
fun encode/1,
fun decode/1

in a separate foo__bar.erl module. It will do the right thing for
nested messages and enums.

Make a new Bar message with zap set to 100 is as simple as Bar =
foo__bar:s_zap([], 100).

There are still a number of things to be done and this is mentioned in
the roadmap but I am announcing it now as it is useable (I believe)
and hopefully people may benefit from it. Also (shameless plug), if
you like working on things like this, consider working with us at
Quark Games and send me an email :). We're always looking for great
people to work with.

Best,
Jeremy



More information about the erlang-questions mailing list