start_link/5's @spec wasn't updated when it signature was last changed.
Also add a @spec to init/6 and mark some internal functions as private.
We only support :ranch_tcp at the moment, so that's explicitly enforced
in both the typespecs as well as the init/6 function head.
This also disables the "Readability.Specs" check because it appears to
crash Credo when it encounters some of our macro-ized code. That can be
investigated separately.
This gives us the ability to use 1.3+ APIs as we develop our 2.0 branch.
Many other libraries (Absinthe, Dialyxir) also have a 1.3+ requirement.
Also, Elixir 1.4 is imminent, so add that to our testing matrix too.
* Binary Framed server
This is the implementation of the binary thrift framed server. It features
a configurable acceptor pool and generates code to make serialization and
deserialization automatic.
This appears to be case-sensitive, and I wasn't noticing because the
macOS's file system isn't.
Also, remove the Apache License batch from the README because it doesn't
render that well as part of the generated documentation. We may want to
remove the other badges later too if we continue to use the README as a
key part of our Hex-published docs.
We still have a copy under test/support/src/ that's used by our
integration tests, but we otherwise no longer have any need to ship a
copy of Apache Thrift Erlang runtime.
Define :test-specific (instead of :prod-specific) lists of build paths.
This fixes an issue where :dev builds would include test code and things
like `mix docs` would parse and document tests.
Because our benchmarks also use test code (e.g. ParserUtils), that
command is runs in the :test environment.
* Generated Thrift client
This PR is the start of an auto-generated Framed Thrift Binary Protocol
client.
Some work was needed in order to make the client work. This included
modifying the existing generators to:
* Properly handle void return types
* Create exceptions using defexception rather than defstruct.
I also modified the thrift test case so it was able to pass context from
setup functions. This is necessary because testing is accomplished by
creating an erlang server off of a test client and running actual thrift
calls against it. I've validated a number of different scenarios, and
all appear to work
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
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 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.
This represents just the lexer definition. Full grammar parsing (i.e. yecc)
support will come later.
The lexer definition is largely complete, but there may be some issues with
string literals containing escaped characters \t and \n.