This gives the user more fine grained control over which .thrift files are
processed. For instance, a directory might contain many files but you only want
one or a few.
A pure Elixir implementation of the Thrift binary protocol.
This PR includes serialization and deserialization for all thrift types as well as testing to make sure we match the thrift spec (which can be found here: https://erikvanoosten.github.io/thrift-missing-specification/#_binary_encoding)
The binary protocol is generated alongside the thrift data types, yielding a much faster implementation than the apache project's canonical one.
Our benchmarks (using benchfella) indicate a speedup of between 10 and 20x.
## Binary Protocol Performance
benchmark name | iterations | average time
------------------|-----------|---------------
elixir serialization (left as IOList) | 2000 | 849.01 µs/op
elixir serialization (iolist_size) | 2000 | 933.83 µs/op
elixir serialization (converted to binary) | 1000 | 1281.23 µs/op
elixir deserialization | 1000 | 1178.46 µs/op
erlang serialization left as IOList | 100 | 10284.84 µs/op
erlang serialization (converted to binary) | 100 | 11588.89 µs/op
erlang deserialization | 100 | 21433.17 µs/op
This pattern's literal `\` characters were unnecessarily escaped,
probably as a transcription error from the original lex source code.
This causes this pattern to misbehave and conflict with the {COMMENT}
rule.
The test suite has been extended to cover juxtapositional comment cases,
too, which ensures were correctly account for whitespace within and
around comments.
* File Parser / Resolver
The parser can now take a single thrift file and follow all its
includes and parse them as well. The output is stored in a FileGroup,
which is returned.
Added a resolver to handle resolution of struct references. As
references are added to the FileGroup, they are placed in the resolver
and after parsing is complete, added to the resolutions field in the
FileGroup.
* Fixed bad spec
* Removed dead code; increased unit test coverage
* placed __file__ directive at the end.
* Addressed PR comments
* update -> canonicalize
* Changed from using mktemp
* Fixed spelling
Add test coverage for the last two remaining error cases. This brings
this module's unit test coverage up to 100%.
This also includes one functional change: we now redirect :stderr output
to :stdout so we can more consistently capture and display output from
the Thrift compiler executable.
With today's release of Elixir 1.3, now is a good time to drop compatibility
with much older releases. This also lets us use some of the nicer language
features introduced in Elixir 1.2, like the multi-alias syntax.
This approach introduces private merge/2 functions that match on the
individual model types that we want to merge into our schema. This
simplifies the top-level reduction.
This PR introduces a parser based on @jparise's lexer. The parser
runs on thrift files and produces a set of Program models. The
intention is to be able to give Elixir full-fledged thrift support
and a better implementation.