Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
priv
test
.gitignore
LICENSE
Makefile
README.md
mix.exs

README.md

Elixir Flatbuffers

Parses flatbuffers from/to json using a port that links the native C++ implementation. The communication is done via erlang packets to optimise the IO throughput. See priv/fb_port.cpp for the C++ side of the implementation.

Once loaded, schemas are kept within the memory of the port so they don't have to be loaded for each conversion. It is possible to load multiple schemas.

The result of a conversion will be send back to the process that called the function. The response can be parsed with parse_repsonse/1.

Usage

  # start the port
  port = FlatbufferPort.open_port()

  # load a schema
  FlatbufferPort.load_schema(port, schema)

  # convert a json string to flatbuffer
  FlatbufferPort.json_to_fb(port, json)

  # convert a flatbuffer to json
  FlatbufferPort.fb_to_json(port, flatbuffer)

  # wait for result
  receive do
      {^port, {:data, data}} -> FlatbufferPort.parse_reponse(data)
  after
    3_000 -> :timeout
  end
You can’t perform that action at this time.