Arangox v0.2.1 Arangox.Client behaviour View Source
HTTP client behaviour for Arangox
.
To use an http library other than :gun
or Mint
, implement this behaviour
in a module and pass that module to the :client
start option. Arangox
will use that implementation to perform all it's http related connection and
execution operations.
Link to this section Summary
Callbacks
Receives a raw endpoint binary and all the start options from Arangox.start_link/1
.
Receives a Arangox.Request
struct and a connection's state, an Arangox.Connection
struct, and returns an Arangox.Response
struct or error (or exception struct),
along with the new state.
Link to this section Types
Link to this section Functions
Link to this section Callbacks
connect(endpoint, start_options)
View Sourceconnect(endpoint(), start_options()) :: {:ok, conn()} | {:error, exception_or_reason()}
Receives a raw endpoint binary and all the start options from Arangox.start_link/1
.
The Arangox.Endpoint
module has utilities for parsing ArangoDB endpoints.
The conn
returned from this callback gets placed in the :socket
field
of an %Arango.Connection{}
struct, which represents a connection's state.
It's up to the client to consolidate the :connect_timeout
, :transport_opts
and :client_opts
options.
Receives a Arangox.Request
struct and a connection's state, an Arangox.Connection
struct, and returns an Arangox.Response
struct or error (or exception struct),
along with the new state.
Arangox handles the encoding and decoding of request and response bodies.
In the case of an error, this should return {:error, :noproc, state}
if the connection
was lost, otherwise an attempt to reconnect won't be made until the next request hitting
this process fails.