mix typedb.grpc.gen (TypeDB.GRPC v0.1.0)

Copy Markdown View Source

Regenerates the protobuf and gRPC stub modules under lib/protocol/.

mix typedb.grpc.gen 3.12.0
mix typedb.grpc.gen --path /somewhere/typedb-protocol

The generated modules are committed rather than built at compile time, and that is a deliberate trade. Generating them during the build would put protoc and a network fetch of typedb-protocol between this package and every one of its users, on every machine, forever — for output that changes only when TypeDB releases a new protocol. Committing it means the package installs like any other, and the cost is remembering to run this task.

What it does not do is decide which protocol version is right. The version lives in TypeDB.GRPC.Protocol.version/0, next to the generated code it describes, and the integration suite checks it against whichever server it is pointed at — so a mismatch is a red test rather than a decoding failure in somebody's application.

Requirements

protoc and protoc-gen-elixir on PATH:

mix escript.install hex protobuf
# then add ~/.mix/escripts to PATH

Options

  • --path — a checkout of typedb-protocol to generate from, instead of cloning the version given as an argument
  • --out — where to write, defaulting to lib/protocol