egrpc_stub (egrpc v0.1.1)

View Source

Summary

Types

bidi_streaming_ret/0

-type bidi_streaming_ret() :: streaming_ret().

channel/0

-type channel() ::
          #channel{host :: string(),
                   port :: inet:port_number(),
                   codec :: module(),
                   unary_interceptors :: [unary_interceptor()],
                   stream_interceptors :: [{stream_interceptor(), State :: any()}],
                   conn_pid :: pid(),
                   headers :: [{binary(), binary()}],
                   opts :: conn_opts()}.

client_streaming_ret/0

-type client_streaming_ret() :: streaming_ret().

conn_opts/0

-type conn_opts() ::
          #{gun_opts => gun:opts(),
            unary_interceptors => [unary_interceptor()],
            stream_interceptors => [stream_interceptor() | {stream_interceptor(), any()}],
            retry => non_neg_integer(),
            info => term()}.

metadata/0

-type metadata() :: #{binary() => binary()}.

next/0

-type next() :: fun((egrpc:stream(), request(), opts()) -> unary_interceptor_ret()).

opts/0

-type opts() :: #{metadata => metadata()}.

request/0

-type request() :: map().

response/0

-type response() :: map().

server_streaming_ret/0

-type server_streaming_ret() :: streaming_ret().

stream_interceptor/0

-type stream_interceptor() :: module().

streaming_ret/0

-type streaming_ret() :: {ok, egrpc:stream()} | {error, any()}.

unary_interceptor/0

-type unary_interceptor() :: fun((egrpc:stream(), request(), opts(), next()) -> unary_interceptor_ret()).

unary_interceptor_ret/0

-type unary_interceptor_ret() :: {ok, response()} | {error, egrpc_error:grpc_error() | any()}.

unary_ret/1

-type unary_ret(Res) :: {ok, Res} | {error, any()}.

Functions

await_up(Channel)

-spec await_up(channel()) -> {ok, channel()} | {error, any()}.

bidi_streaming(Channel, Grpc, Opts)

-spec bidi_streaming(channel(), Grpc, Opts) -> {ok, egrpc:stream()} | {error, any()}
                        when Opts :: opts(), Grpc :: egrpc:grpc().

client_streaming(Channel, Grpc, Opts)

-spec client_streaming(channel(), Grpc, Opts) -> {ok, egrpc:stream()} | {error, any()}
                          when Opts :: opts(), Grpc :: egrpc:grpc().

close(Channel)

-spec close(channel()) -> ok.

close(Channel, _)

-spec close(channel(), boolean()) -> ok.

codec(Channel)

conn_pid(Channel)

-spec conn_pid(egrpc:stream() | channel()) -> pid().

host(Channel)

-spec host(channel()) -> string().

info(Channel)

-spec info(channel()) -> undefined | any().

info(Channel, Default)

-spec info(channel(), Default) -> any() | Default.

open(Host, Port, Opts0)

-spec open(Host, Port, conn_opts()) -> {ok, channel()} | {error, any()}
              when Host :: string(), Port :: inet:port_number().

port(Channel)

-spec port(channel()) -> inet:port_number().

server_streaming(Channel, Request, Grpc, Opts)

-spec server_streaming(channel(), Request, Grpc, Opts) -> {ok, egrpc:stream()} | {error, any()}
                          when Request :: map(), Opts :: opts(), Grpc :: egrpc:grpc().

set_info(Channel, Info)

stream_interceptors(Channel)

unary(Channel, Request, Grpc, Opts)

-spec unary(channel(), Request, Grpc, Opts) -> unary_ret(Response)
               when Request :: map(), Response :: map(), Opts :: opts(), Grpc :: egrpc:grpc().

unary_interceptors(Channel)