livery_grpc_service (livery_grpc v0.1.1)
View SourceService descriptors, derived from a gpb-generated module at runtime.
A .proto compiled by rebar3_gpb_plugin yields a module (e.g.
helloworld_pb) that already carries introspection: get_package_name/0,
get_service_names/0, and get_service_def/1. Rather than generate a
second set of *_grpc.erl modules at build time, this module reads that
introspection and produces method descriptors the server and client use:
the wire path, the input/output message names, and the call kind (unary,
server-streaming, client-streaming, bidirectional).
A method descriptor is the unit both sides key on: the server matches an
inbound :path to one, the client builds a request from one.
Summary
Functions
Map an RPC method name to its callback function name: CamelCase to
snake_case ('SayHello' -> say_hello, 'HTTPGet' -> http_get). A
run of capitals is kept together, with a break before the final capital
that starts the next word.
Build a path-keyed routing index from a list of registrations.
The call kind from the input/output streaming flags.
One method descriptor by service and method name.
The method descriptors of one service in a proto module.
The proto package as a binary, or <<>> when none is declared.
The wire path for a method: /package.Service/Method, or
/Service/Method when the proto declares no package.
Join a package and a local name into a fully qualified name.
The fully qualified service name, e.g. <<"helloworld.Greeter">>.
All service names declared in a proto module.
Types
-type kind() :: unary | server_stream | client_stream | bidi.
Functions
Map an RPC method name to its callback function name: CamelCase to
snake_case ('SayHello' -> say_hello, 'HTTPGet' -> http_get). A
run of capitals is kept together, with a break before the final capital
that starts the next word.
-spec index([registration()]) -> #{binary() => {method(), module()}}.
Build a path-keyed routing index from a list of registrations.
Each entry maps a wire path to {Method, Handler}: the method descriptor
plus the callback module that serves it. The server uses this to dispatch
an inbound request in one map lookup.
The call kind from the input/output streaming flags.
One method descriptor by service and method name.
The method descriptors of one service in a proto module.
The proto package as a binary, or <<>> when none is declared.
The wire path for a method: /package.Service/Method, or
/Service/Method when the proto declares no package.
Join a package and a local name into a fully qualified name.
The fully qualified service name, e.g. <<"helloworld.Greeter">>.
All service names declared in a proto module.