thrift_runtime_options (thrift_runtime v0.7.0)

View Source

The runtime's option surface in one place: defaults and typed getters.

Every endpoint parses its options at creation time from the map the caller passes. This module keeps the defaults from drifting apart across thrift_runtime_acceptor, thrift_runtime_connection, thrift_runtime_client and thrift_runtime_reconnecting_client, and keeps timeout from meaning three different things: it is the umbrella standing in for every more specific timeout the caller does not name —

  • handshake_timeout — server only: the TLS handshake slice between the transport accept and the handover;
  • idle_timeout — server only: the maximum silence between messages;
  • connect_timeout — client only: the connect and TLS handshake wait.

A specific key wins over the umbrella, the umbrella wins over the default.

Summary

Functions

The {active, N} delivery batch size, default 100.

The connect and TLS handshake timeout of the client side.

The TLS handshake timeout of the server side.

The client-side HTTP path, default <<"/">>.

The maximum silence between messages on the server side.

The live-connection cap, default 1024.

The framed-mode guard and HTTP body bound, default 64 MiB.

The on_event observability handler, default undefined; see thrift_runtime_events. A malformed value fails the start, not the first emit: the returned reason is {on_event, Value}.

The resolved protocol module: the named axis value (binary, compact, json) through thrift_runtime:protocol_module/1, or the caller's own implementation module.

The transport axis: framed (default), buffered or http.

Functions

active_n(Opts)

-spec active_n(map()) -> pos_integer().

The {active, N} delivery batch size, default 100.

connect_timeout(Opts)

-spec connect_timeout(map()) -> pos_integer() | infinity.

The connect and TLS handshake timeout of the client side.

handshake_timeout(Opts)

-spec handshake_timeout(map()) -> pos_integer() | infinity.

The TLS handshake timeout of the server side.

http_path(Opts)

-spec http_path(map()) -> binary().

The client-side HTTP path, default <<"/">>.

idle_timeout(Opts)

-spec idle_timeout(map()) -> pos_integer() | infinity.

The maximum silence between messages on the server side.

max_connections(Opts)

-spec max_connections(map()) -> pos_integer().

The live-connection cap, default 1024.

max_frame_size(Opts)

-spec max_frame_size(map()) -> pos_integer().

The framed-mode guard and HTTP body bound, default 64 MiB.

on_event(Opts)

-spec on_event(map()) -> {ok, thrift_runtime_events:handler()} | {error, {on_event, term()}}.

The on_event observability handler, default undefined; see thrift_runtime_events. A malformed value fails the start, not the first emit: the returned reason is {on_event, Value}.

protocol_module(Opts)

-spec protocol_module(map()) -> {ok, module()} | {error, term()}.

The resolved protocol module: the named axis value (binary, compact, json) through thrift_runtime:protocol_module/1, or the caller's own implementation module.

transport(Opts)

-spec transport(map()) -> thrift_runtime_socket:transport().

The transport axis: framed (default), buffered or http.