View Source backwater (backwater v3.6.0)

Summary

Functions

Performs remote call on Endpoint.

Performs remote call on Endpoint.

Starts a cleartext cowboy listener that can handle remote calls.

Like :start_clear_server/2 but one can specify the listener name and tune settings.

Starts a TLS cowboy listener that can handle remote calls.

Like :start_tls_server/3 but one can specify the listener name and tune (more) settings.

Stops the cowboy listener under the default name.
Stops the cowboy listener under a specific name.

Types

-type call_opts() ::
    #{hackney_opts => [hackney_option()],
      compression_threshold => non_neg_integer(),
      connect_timeout => timeout(),
      decode_unsafe_terms => boolean(),
      max_encoded_result_size => non_neg_integer(),
      recv_timeout => timeout(),
      rethrow_remote_exceptions => boolean()}.
-type call_result() :: backwater_response:t(hackney_error()).
-type clear_opts() :: ranch:opts() | ranch_tcp:opts().
-type hackney_error() :: {hackney, term()}.
-type hackney_option() :: proplists:property().
-type http_opts() :: cowboy_http:opts().
-type route_path() ::
    {nonempty_string(), [], backwater_cowboy_handler, backwater_cowboy_handler:state()}.
-type route_rule() :: {'_' | nonempty_string(), [route_path(), ...]}.
-type stack_item() ::
    {Module :: module(),
     Function :: atom(),
     Arity :: arity() | (Args :: [term()]),
     Location :: [{file, Filename :: string()} | {line, Line :: pos_integer()}]}.
-type tls_opts() :: ranch:opts() | ranch_ssl:opts().

Functions

Link to this function

call(Endpoint, Module, Function, Args)

View Source
-spec call(Endpoint, Module, Function, Args) -> Result | no_return()
        when
            Endpoint :: backwater_request:endpoint(),
            Module :: module(),
            Function :: atom(),
            Args :: [term()],
            Result :: call_result().

Performs remote call on Endpoint.

Returns:
  • {ok, ReturnValue} in case of success
  • {error, term()} otherwise.

See also: call/5.

Link to this function

call(Endpoint, Module, Function, Args, Options)

View Source
-spec call(Endpoint, Module, Function, Args, Options) -> Result | no_return()
        when
            Endpoint :: backwater_request:endpoint(),
            Module :: module(),
            Function :: atom(),
            Args :: [term()],
            Options :: call_opts(),
            Result :: call_result().

Performs remote call on Endpoint.

Returns:
  • {ok, ReturnValue} in case of success
  • {error, term()} otherwise.

See also: call/4.

Link to this function

start_clear_server(Secret, ExposedModules)

View Source
-spec start_clear_server(Secret, ExposedModules) -> {ok, pid()} | {error, term()}
                      when Secret :: binary(), ExposedModules :: [backwater_module_exposure:t()].

Starts a cleartext cowboy listener that can handle remote calls.

Returns:
  • {ok, ServerPid} in case of success
  • {error, term()} otherwise.

See also: start_clear_server/4.

Link to this function

start_clear_server(Ref, Secret, ExposedModules, Opts)

View Source
-spec start_clear_server(Ref, Secret, ExposedModules, Opts) -> {ok, pid()} | {error, term()}
                      when
                          Ref :: term(),
                          Secret :: binary(),
                          ExposedModules :: [backwater_module_exposure:t()],
                          Opts ::
                              backwater_cowboy_handler:opts(clear_opts() | ranch:opts(),
                                                            http_opts()).

Like :start_clear_server/2 but one can specify the listener name and tune settings.

Returns:
  • {ok, ServerPid} in case of success
  • {error, term()} otherwise.

See also: start_clear_server/2.

Link to this function

start_tls_server(Secret, ExposedModules, TLSOpts)

View Source
-spec start_tls_server(Secret, ExposedModules, TLSOpts) -> {ok, pid()} | {error, term()}
                    when
                        Secret :: binary(),
                        ExposedModules :: [backwater_module_exposure:t()],
                        TLSOpts :: tls_opts() | ranch:opts().

Starts a TLS cowboy listener that can handle remote calls.

Returns:
  • {ok, ServerPid} in case of success
  • {error, term()} otherwise.

See also: start_tls_server/4.

Link to this function

start_tls_server(Ref, Secret, ExposedModules, Opts)

View Source
-spec start_tls_server(Ref, Secret, ExposedModules, Opts) -> {ok, pid()} | {error, term()}
                    when
                        Ref :: term(),
                        Secret :: binary(),
                        ExposedModules :: [backwater_module_exposure:t()],
                        Opts ::
                            backwater_cowboy_handler:opts(tls_opts() | ranch:opts(), http_opts()).

Like :start_tls_server/3 but one can specify the listener name and tune (more) settings.

Returns:
  • {ok, ServerPid} in case of success
  • {error, term()} otherwise.

See also: start_tls_server/3.

-spec stop_server() -> ok | {error, not_found}.
Stops the cowboy listener under the default name.
-spec stop_server(Ref) -> ok | {error, not_found} when Ref :: term().
Stops the cowboy listener under a specific name.