- Reworked
SpaceEx.Stream.subscribe/2.- Now delivers raw, undecoded results.
- No longer unsubscribes after a single message (unless using
removeoption). - Most user code will want to use the new
SpaceEx.Stream.receive_latest/2; some may wantSpaceEx.Stream.receive_next/2. - Breaking API change. Most existing code will fail quickly due to attempting to subscribe multiple times.
- Added
SpaceEx.Stream.receive_latest/2.- Receives latest subscribed result in process mailbox.
- Safe from mailbox overflow due to skipping older results.
- Added
SpaceEx.Stream.receive_next/2.- Receives next subscribed result in process mailbox.
- Safe from mailbox overflow due to enforcing a maximum message age.
- Added
SpaceEx.ExpressionBuilder, a far easier way to createSpaceEx.KRPC.Expressionobjects.- Converted
sub_orbital_flight.exsto use the new expression builder.
- Converted
- Added the
start: falseoption toSpaceEx.Event.create/2.- Can be used to create an event but start checking it later.
- Added
SpaceEx.Event.start/1to manually start an event stream. - Added
SpaceEx.Event.set_rate/2to set the polling rate of an event. - Added
SpaceEx.Stream.subscribe/2andSpaceEx.Event.subscribe/2to allow asynchronous handling of streams and events.
- Fixed the
SpaceEx.Connection.connectandconnect!to allow zero args again. - Replaced
SpaceEx.Stream.stream_fn/2withSpaceEx.Stream.with_get_fn/1.... |> Stream.stream_fnis now... |> Stream.stream |> Stream.with_get_fn
- Removed the
connargument fromSpaceEx.Event.create/1.- It can derive
connfromexpr. - This also allows for expressions to be pipelined in.
- It can derive
- Changed
SpaceEx.Event.wait/2to use keyword options.- Timeout is now
opts[:timeout]. - Added
opts[:remove], defaulttrue.
- Timeout is now
- Fixed bugs with
SpaceEx.Stream.set_rate/2andSpaceEx.Stream.start/1. - Fixed race condition with
SpaceEx.Streamshutdown.SpaceEx.KRPC.remove_stream/2now has acast_remove_streamversion to facilitate this.- Now potentially easy to add
cast_versions to other functions.
- Added more tests for
SpaceEx.StreamandSpaceEx.Event. - Stricter parameter and return type validation for
SpaceEx.Streamcalls. - API documentation now gives details on every RPC function's return value.
- This helps users know what constant types to use in Expressions and the ExpressionBuilder.
- Examples split out into their own directories.
- Multiple versions of each, in progessively more Elixir-y style.
- Renamed
SpaceEx.ProceduretoProcedureCall. - Add
SpaceEx.Connection.connect/1, the Erlang-style version ofconnect!. - Add
SpaceEx.Connection.close/1. - Connection process lifecycle changes:
- The concept is still the same, but we handle exits (particularly
exit(:normal)) better. - The entire
Connection,StreamConnection, and all activeStreams should exit together now, either cleanly or on error. - We still link the
Connectionprocess to the launching process.
- The concept is still the same, but we handle exits (particularly
- Connections will now handle server disconnects better.
- They'll still blow up, of course, but with a meaningful message.
- Updated docs:
- Used absolute URLs, so links work whether on HexDocs or GitHub.
- Fixed code-quoted HTML entities showing up, e.g. for
SpaceEx.SpaceCenter.launch_vessel/4.
- Add tests for core classes:
ConnectionStreamConnectionStreamEvent
- Add selective mocked tests for API calls:
KRPCSpaceCenter
- Add some missing encoders and decoders.
- These aren't used in the API, but they offer symmetry, e.g. encoding values we know how to decode and vice versa.
- Tests added as well.
- Rework parts of
SpaceEx.Gen.- We no longer have to pass
conn_varandvalue_vararound. - Only three
var!(x)s required; the rest are bare. - We use
location: :keepon everyquote, so stack traces will be more sensible now.
- We no longer have to pass
- Added Travis CI testing.
- We can now guarantee compatibility with Elixir 1.5/1.6, and OTP 18/19/20.
- Fixed a bug that was causing every function to have an
optsargument, even if it didn't have any optional args. - Fixed a crash when a
Connectiontries to terminate because its parent process has exited. Now it should crash correctly. 🙂 - Added some tests. More to come.
Major (and very breaking) overhaul to function arguments.
- Functions that return remote object reference(s) —
SpaceCenter.active_vessel,Orbit.body, etc. — will now return structure(s) containing the reference and the connection it was retrieved via. - Functions that take a
thisparameter as their first argument —Vessel.max_thrust,Flight.mean_altitude, etc. — no longer take aconnargument before thethisargument. Instead, they use the connection fromthis. - For example,
Vessel.max_thrust(conn, vessel)becomesVessel.max_thrust(vessel). - This also means functions are now chainable, e.g.
SpaceCenter.active_vessel(conn) |> Vessel.max_thrust().
- Functions that have arguments with default values, now expect those arguments in a
key: valuekeyword list form. - Said arguments can be omitted, and will send the default value if so.
- For example,
Vessel.flight(vessel, frame)is now eitherVessel.flight(vessel, reference_frame: frame), orVessel.flight(vessel)if the default value is desired.
- New stream functions added:
SpaceEx.Stream.start/2SpaceEx.Stream.remove/2
- Multiple attempts to stream the same data will no longer result in hanging behaviour.
- Instead, they'll all reuse the same
Streamprocess.
- Instead, they'll all reuse the same
- Streams are no longer linked to the process that creates them.
- This becomes dangerous behaviour when multiple independent streaming requests can result in using the same process.
- Instead, they're linked to the
StreamConnectionprocess.
- The
StreamConnectionprocess is now linked to theConnectionprocess.- They were previously "linked by proxy" via the process that created them, but became unlinked if that process exited normally.
- Now, the
Connection,StreamConnection, and allStreamprocesses are linked, and an error in any will take the whole connection stack down.
- Streams are now "bonded" to any process that requests their creation, even if they're being reused.
- Calling
remove/2will terminate the bond. - The stream will automatically shut itself down (and request removal from the server) if all bonds call
remove/2or terminate.
- Calling
Event.removeadded; delegates toStream.remove.
Procedure.newremoved.- Procedures are now generated by internal methods on the service modules themselves; it no longer makes sense to manually create them.
- Connections now explicitly
Process.monitorthe process that launched them, and exit when that process does. - Documentation now correctly lists parameters in
snake_caserather thancamelCase. - Several KRPC functions are now marked as undocumented (hidden):
add_streamadd_eventremove_streamset_stream_ratestart_stream- These functions are used internally by the
EventandStreamclasses and should not be used directly.
- Upgraded to Elixir 1.6:
- All warnings fixed.
- All code reformatted using the new auto-formatter.
- Complete rewrite of the API JSON parsing code.
- The API should remain 100% the same, but the internals are much cleaner now.
- All aspects of the JSON are parsed immediately under the
SpaceEx.APImodule. - Types are parsed into
SpaceEx.API.Type.*structs at compile time. - Runtime type encoding/decoding uses functions instead of macros.
- Documentation now builds an index of cross-references and uses that instead of guesswork.
Stream.waitadded.- Events added.
- sub_orbital_flight.exs and .craft added, ported from kRPC SubOrbitalFlight.py. Provides example of Events.
- launch_into_orbit.craft added, and .exs made more true to original.
- Breaking changes to RPC call syntax:
- All calls return their return value directly, not an
{:ok, value}tuple. SpaceEx.Connection.RPCErroris raised on errors instead.- All
get_andstatic_function prefixes are removed. - ExDoc examples and example scripts still need to be updated.
- All calls return their return value directly, not an
- Changelog created.
- Stream functionality added.