View Source GRPC.Client.Adapter behaviour (grpc v0.9.0)

HTTP client adapter for GRPC.

Summary

Types

Determines if the headers have finished being read.

Callbacks

Cancel a stream in a streaming client.

Similarly to the option sent on send_data/2 - :send_end_stream - this callback will end request stream

Check GRPC.Stub.recv/2 for more context about the return types

This callback will be responsible to send data to the server on a stream request is open using send_headers/2 Opts

This callback is used to open a stream connection to the server. Mostly used when the payload for this request is streamed. To send data using the open stream request, you should use send_data/3

Types

@type fin() :: :fin | :nofin

Determines if the headers have finished being read.

Callbacks

@callback cancel(stream :: GRPC.Client.Stream.t()) :: :ok | {:error, any()}

Cancel a stream in a streaming client.

@callback connect(channel :: GRPC.Channel.t(), opts :: keyword()) ::
  {:ok, GRPC.Channel.t()} | {:error, any()}
@callback disconnect(channel :: GRPC.Channel.t()) ::
  {:ok, GRPC.Channel.t()} | {:error, any()}
@callback end_stream(stream :: GRPC.Client.Stream.t()) :: GRPC.Client.Stream.t()

Similarly to the option sent on send_data/2 - :send_end_stream - this callback will end request stream

Link to this callback

receive_data(stream, opts)

View Source
@callback receive_data(stream :: GRPC.Client.Stream.t(), opts :: keyword()) ::
  GRPC.Stub.receive_data_return() | {:error, any()}

Check GRPC.Stub.recv/2 for more context about the return types

Link to this callback

send_data(stream, message, opts)

View Source
@callback send_data(
  stream :: GRPC.Client.Stream.t(),
  message :: binary(),
  opts :: keyword()
) ::
  GRPC.Client.Stream.t()

This callback will be responsible to send data to the server on a stream request is open using send_headers/2 Opts:

- :send_end_stream (optional) - ends the request stream
Link to this callback

send_headers(stream, opts)

View Source
@callback send_headers(stream :: GRPC.Client.Stream.t(), opts :: keyword()) ::
  GRPC.Client.Stream.t()

This callback is used to open a stream connection to the server. Mostly used when the payload for this request is streamed. To send data using the open stream request, you should use send_data/3

Link to this callback

send_request(stream, contents, opts)

View Source
@callback send_request(
  stream :: GRPC.Client.Stream.t(),
  contents :: binary(),
  opts :: keyword()
) ::
  GRPC.Client.Stream.t()