Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
oberstet committed Apr 23, 2018
1 parent a0e333e commit a446fa0
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 37 deletions.
64 changes: 64 additions & 0 deletions flatbuffers/README.md
Expand Up @@ -167,6 +167,70 @@ The following patches are required currently for flatc: [this PR](https://github

---


## Usage

This folder contains a [Makefile](Makefile) that allows to compile all WAMP FlatBuffers schemata and generate binding code in various languages using

```console
make clean build cloc
```

Here is example output (a total of 30k LOC generated from 500 LOC .fbs):

```console
cpy2714_1) oberstet@thinkpad-t430s:~/scm/wamp-proto/wamp-proto/flatbuffers$ make clean build cloc
rm -rf ./_build
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/schema/ --binary --schema --bfbs-comments --bfbs-builtin-attrs *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/cpp/ --cpp *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/csharp/ --csharp *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/go/ --go *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/java/ --java *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/js/ --js *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/php/ --php *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/python/ --python *.fbs
/home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/ts/ --ts *.fbs
cloc --read-lang-def=cloc.def --exclude-dir=_build .
11 text files.
11 unique files.
2 files ignored.

github.com/AlDanial/cloc v 1.76 T=0.01 s (774.6 files/s, 113640.1 lines/s)
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
FlatBuffers 7 314 372 535
Markdown 1 64 0 119
make 1 20 8 30
Windows Module Definition 1 0 0 5
---------------------------------------------------------------------------------------
SUM: 10 398 380 689
---------------------------------------------------------------------------------------
cloc ./_build
331 text files.
331 unique files.
2 files ignored.

github.com/AlDanial/cloc v 1.76 T=0.35 s (942.1 files/s, 132452.9 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 7 405 7 5629
PHP 62 961 3206 5006
Go 62 826 62 4815
TypeScript 7 832 3430 3428
JavaScript 7 896 3493 3177
Java 62 439 62 2825
C# 62 477 186 2800
Python 62 616 454 2504
-------------------------------------------------------------------------------
SUM: 331 5452 10900 30184
-------------------------------------------------------------------------------
```

---


## Notes

* FlatBuffers [currently lacks](https://github.com/google/flatbuffers/issues/4237) syntax highlighting on GitHub.
Expand Down
54 changes: 17 additions & 37 deletions flatbuffers/wamp.fbs
Expand Up @@ -7,50 +7,30 @@
//
//////////////////////////////////////////////////////////////////////////////

/* WAMP at the application level exposes 4 roles:

- Caller and Callee
- Publisher and Subscriber

To decouple each pair of roles (or actors), WAMP uses an intermediary
that may implement two additional roles:

- Dealer, to forward calls from Callers to Callees
- Broker, to dispatch events from Publishers to Subscribers

WAMP is then defined in terms of message flow between those 6 roles.
There 26 WAMP messages at the wire level, and these are defined
(structurally) using FlatBuffers IDL in below.

Note: This FlatBuffers based specification of WAMP can be mapped
directly to the existing, dynamically typed WAMP serializations.

To generate code, enter

flatc --python -o _build wamp.fbs

using one of:

* --cpp -c Generate C++ headers for tables/structs.
* --go -g Generate Go files for tables/structs.
* --java -j Generate Java classes for tables/structs.
* --js -s Generate JavaScript code for tables/structs.
* --ts -T Generate TypeScript code for tables/structs.
* --csharp -n Generate C# classes for tables/structs.
* --python -p Generate Python files for tables/structs.
* --php Generate PHP files for tables/structs.

This will generated bindings to access FlatBuffers data in the schema below
from the selected host language.
*/

include "types.fbs";
include "roles.fbs";
include "auth.fbs";
include "session.fbs";
include "pubsub.fbs";
include "rpc.fbs";


// Web Application Message Protocol (WAMP) namespace.
//
// WAMP at the application level exposes 4 roles:
//
// - Caller and Callee
// - Publisher and Subscriber
//
// To decouple each pair of roles (or actors), WAMP uses an intermediary
// that may implement two additional roles:
//
// - Dealer, to forward calls from Callers to Callees
// - Broker, to dispatch events from Publishers to Subscribers
//
// WAMP is then defined in terms of message flow between those 6 roles.
// There 26 WAMP messages at the wire level, and these are defined
// (structurally) using FlatBuffers in this namespace.
namespace wamp.proto;


Expand Down

0 comments on commit a446fa0

Please sign in to comment.