* Refactor Client generated/static interface
This moves message serialization completely into Binary.Framed.Client, and
response decoding completely out into the generated client. Their
responsibilities are more coherent. It also puts us into position for future
potential improvements, such as moving seq_id management into the connection
process's state, and generating code to match response exceptions in the way we
currently match unions.
* Return TApplicationException for invalid message type
* Keep seq_id in connection process state
* PR feedback
The tmp directory is used to store temporary .thrift and generated files by
ThriftTestCase. It's typically around during development and contains files but
they should not be checked in.
Seems to have been overlooked. We implemented strings, which are effectively
the same in Elixir, but didn't check specifically for a type of :binary in
every situation.
Previously when the parser found a reference where it expected a static value,
it treated it as an enum. However it could also be a const. Now the parser
turns any reference into a StructRef and leaves it to the next layer to resolve
the reference.
Fixes#140.
* Server improvements
The server's start_link didn't actually start_link. I've changed this to
bring the server's supervision into the user's application.
Also, we weren't properly cleaning up after server errors, so now I just crash.
* Allow 'default required' fields to be nil
We discovered that other Thrift implementations we use internally do not
serialize unset 'default required' fields. This change brings our
implementation's behavior in line with the others.
* Test that optional fields are serialized
- Our command line options now more closely mimic the Apache Thrift
compiler's. We support both long and "short" option formats.
- The compile task's output now simply prints "Compiling N files", which
is the Elixir 1.3+ output convention. Use the `--verbose` command line
option to see per-file output.
- The compiler task's unit test helper code has been simplified a bit.
Enforce field requiredness during serialization
The IDL spec [1] states that required fields must always be written during
serialization. There are also "default required" fields, i.e. fields specified
neither as required or optional. Apparently they also should always be written,
though there are exceptions to which the spec alludes but about which it does
not deign to elaborate.
[1]: https://thrift.apache.org/docs/idl#field-requiredness
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.
Our :thrift compiler is now implemented in terms of our Elixir code
generation framework. This drops our dependency on the Apache Thrift
compiler binary.
The new Thrift.Generator.targets/1 function is used to determine the
full set of generated output files for a given input .thrift file. This
ensures that we only generate Elixir source code for stale outputs.
It can now do everything that `thrift.generate` could do, so we can
retire the latter.
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.