• Stars
    star
    132
  • Rank 274,205 (Top 6 %)
  • Language
    Erlang
  • Created almost 16 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of Protocol Buffers tools and modules for Erlang applications.

README

This module is a composite of other open source modules and original code to make interfacing with the Protocol Buffers protocol easy.

Encode / Decode

Encoding is simple.

1> protobuffs:encode(1, 1, uint32).
<<8,1>>
2> erlang:iolist_to_binary([
    protobuffs:encode(1, <<"Nick">>, string),
    protobuffs:encode(2, 25, uint32)
]).
<<10,4,78,105,99,107,16,25>>

Decoding is simple too.

1> protobuffs:decode(<<8, 1>>, uint32).
{{1, 1}, <<>>}
2> protobuffs:decode(<<10,4,78,105,99,107,16,25>>, bytes).
{{1, <<"Nick">>}, <<16,25>>}
3> protobuffs:decode(<<16,25>>, bytes).
{{2, 25}, <<>>}

Using .proto Files

The main objective of this module is to allow developers to use .proto files easily. This module provides very basic functionality to do so.

Consider the t/simple.proto file.

message Person {
	required string name = 1;
	required string address = 2;
	required string phone_number = 3;
	required int32 age = 4;
}

From that file we can create an Erlang module that can encode and decode the Person message into records.

1> protobuffs_compile:scan_file("simple.proto").
ok
2> simple_pb:decode_person(<<10,4,78,105,99,107,18,13,77,111,...>>).
{person,<<"Nick">>,<<"Mountain View">>, <<"+1 (000) 555-1234">>,25}
3> simple_pb:encode_person({person, <<"Nick">>, <<"Mountain View">>,
    <<"+1 (000) 555-1234">>,25}).
<<10,4,78,105,99,107,18,13,77,111,117,110,116,97,105,110,32,86,105,...>>

How cool is that? From .proto files, we create modules that export encode and decode functions for the messages defined.

CAVEATS

Support for parsing proto files and creating code from it is volatile and should be considered alpha software at best. It currently only supports flat messages, simple types (ints, strings, etc) and will break on ENUM types and any sort of nesting. Please do not use this in production.

no_debug_info

The protobuffs_compile module relies on the pokemon_pb module being compiled with debug info. This is because pokemon_pb serves as a template for generated _pb modules. Running protobuffs_compile:scan_file/1 reads the erlang forms from the pokemon_pb.beam file and expands and alters those forms to create the generated module.

CREDITS

Some of the protobuffs.erl module came from code written by Brian Buchanan.

Some of the protobuffs_compile.erl module came from code written by Tim Fletcher.

The rest of it and it's test suite was written by Nick Gerakines. Major contributions have been made by Jacob Vorreuter.

More Repositories

1

commitment

A commit message generator that I use.
Python
1,202
star
2

erlang_twitter

An Erlang twitter client
Erlang
113
star
3

etap

etap is a simple erlang testing library that provides TAP compliant output.
Erlang
91
star
4

erlang_couchdb

This is another erlang CouchDB client. It is a little simpler than most and does what I want.
Erlang
88
star
5

erlang_facebook

A simple Facebook Platform API interface in Erlang.
Erlang
62
star
6

erlang_nginx

A proof of concept to demonstrate how nginx and Erlang play nicely together.
C
53
star
7

mochevent

A libevent based webserver that is somewhat compliant with mochiweb.
Erlang
36
star
8

express-typescript-sequelize

TypeScript
36
star
9

ginpongo2

Go
33
star
10

barbershop

A simple priority queue service built with libevent.
Shell
30
star
11

s3imagehost

An erlang powered image store using amazon s3.
Erlang
25
star
12

erlang_mysql

A GitHub mirror of the native Erlang MySQL client library.
Erlang
23
star
13

terraform-docker-swarm-aws

HCL
17
star
14

apevents

A federated event management system
Rust
16
star
15

heman

Masters of the universe ... of stats
Erlang
12
star
16

erlang_portage

A collection of ebuilds for various Erlang packages and projects.
11
star
17

erlangquicktips

A blog full of useful Erlang snippets, code blocks and tips.
Ruby
10
star
18

syslognif

A small nif to tap into syslog from an Erlang node.
Erlang
10
star
19

cerlan

A Calender About Nothing port in Erlang.
Erlang
9
star
20

facebook_wiiinfo

An open source Facebook application written in Erlang
Erlang
9
star
21

erlang_wowarmory

A safe, as in throttled, erlang interface to the World of Warcraft Armory.
Erlang
9
star
22

stateless_server

This is a gen_server clone with the frills.
Erlang
8
star
23

protoc-gen-whatever

A protoc plugin use to generate arbitrary files from protocol buffer definitions.
Go
8
star
24

auroraops

A tool that allows you to interact with a nanoleaf aurora programmatically.
Go
7
star
25

erlang_geohash

A collection of Erlang utilities to encode and decode geohashes.
Erlang
7
star
26

perl-test-notabs

The Test::NoTabs perl library
Perl
6
star
27

oxen

A hybrid bittorrent client for low-resource environments.
C++
6
star
28

perl-catalyst-plugin-facebook

Perl
5
star
29

logbook

A personal work log application.
Python
5
star
30

whatsup

A realm status website.
Python
5
star
31

erlang_lighthouse

An Erlang client to interact with lighthouse
Erlang
5
star
32

perl-apache2-mogile-dispatch

4
star
33

wrs

WRS is the World of Warcraft Realm Status toolkit. It has a number of applications and utilities used to monitor World of Warcraft realms.
Erlang
4
star
34

pr-has-issues-action

Rust
4
star
35

githubby

Erlang
4
star
36

pyhelot

Helot is a cluster command and control application that uses Serf.
Python
4
star
37

gobook

A small port of my logbook web app to Go.
JavaScript
4
star
38

perl-net-squid-purge

4
star
39

facebook_application_development_wrox

The official source code for the Wrox book "Facebook Application Development".
4
star
40

perl-apache2-sitemap

3
star
41

queue-tutorials

A few examples of working with queues in java.
Java
3
star
42

deva

A command line utility to control elgato key lights.
Go
3
star
43

perl-www-search-urbandictionary

3
star
44

wow-character-chrome

A small chrome extension to jump to a World of Warcraft character.
JavaScript
3
star
45

erlang-factory

My presentation material for Erlang-Factory 2009.
3
star
46

perl-libs

A public repository of all of the perl modules that I've developed and contributed to.
Perl
3
star
47

camlispp

C++
3
star
48

perl-www-yahoo-keywordextractor

3
star
49

socklabs-blog

The Jekyll repository for blog.socklabs.com.
Ruby
3
star
50

perl-html-adsense

2
star
51

perl-apache-no404proxy-mogile

2
star
52

ngerakines.github.com

ngerakines.github.com
2
star
53

fcache

A small, multi-node memoize system
2
star
54

resume

My resume
TeX
2
star
55

countdown-metrics-rs

A daemon that publishes the number of seconds until a given date to a statsd sink.
Rust
2
star
56

elasticservices

A protocol buffer based framework for creating self coordinating asynchronous services.
Java
2
star
57

cip

A wow addon to help tank and dps members
Lua
2
star
58

perl-net-geohash

2
star
59

perl-net-feedburner

2
star
60

perl-www-wow-realmstatus

2
star
61

perl-iterator-roundrobin

2
star
62

perl-html-map-yahoo-flash

2
star
63

perl-www-robotrules-cache

2
star
64

sferlounge.com

The repository for SF Erlounge.
2
star
65

perl-apache-session-generate-uuid

2
star
66

bingo-2021

A bingo game with friends
Python
1
star
67

spirit-header-tokenizer

A proof of concept http/mime header tokenizer using boost spirit to parse multipart form data.
C++
1
star
68

janet-button

C++
1
star
69

update

A small script used with maid to keep local repos up to date.
Shell
1
star
70

chores

Go
1
star
71

teamprops

Go
1
star
72

earthporn_desktop

Sets the top image on /r/earthporn as your desktop wallpaper.
C#
1
star
73

on-the-clock

Ruby
1
star
74

tram

A read-through HTTP GET cache.
Go
1
star
75

nginx_timestamp

C
1
star
76

wallbase-cc-downloader

A small python script to download top wallpapers from wallbase.cc.
Python
1
star
77

orders

JavaScript
1
star
78

ngerakines.me

1
star
79

cryptoparty

JavaScript
1
star
80

FluentPipeline

A framework for creating event pipelines.
C#
1
star
81

atproto-rs

A suite of libraries, tools, and daemons for atproto.
Rust
1
star