bricks v0.1.0 Bricks.Connector behaviour View Source
A struct, behaviour and functions for working with Socket Connectors
Link to this section Summary
Functions
Attempts to create a connected Socket with the provided Connector
Calls the provided function with a Socket leased from the provided pool
Creates a new Connector from a callback module and a connector object
Callbacks
Create a Socket according to the configuration state
Link to this section Types
lessee() :: (Bricks.Socket.t() -> {:ok, term()} | {:error, term()})
A function which borrows a Socket
State passed to the underlying Connector
A Socket Connector
Link to this section Functions
connect(t()) :: {:ok, Bricks.Socket.t()} | {:error, term()}
Attempts to create a connected Socket with the provided Connector
Calls the provided function with a Socket leased from the provided pool
Returns the socket to the pool or burns it, depending on the return of the provided function.
In the event of error, burns the socket
Creates a new Connector from a callback module and a connector object
Link to this section Callbacks
connect(state()) :: {:ok, Bricks.Socket.t()} | {:error, term()}
Create a Socket according to the configuration state