View Source Xogmios.MempoolTxs behaviour (xogmios v0.8.0)
This module interfaces with the Mempool protocol for reading
transactions as they become available (nextTransaction
).
Summary
Callbacks
Invoked when a new snapshot is acquired.
Invoked upon connecting to the server. This callback is optional.
Invoked upon disconnecting from the server. This callback is optional.
Invoked when a new transaction is made available in the mempool.
Functions
Starts a new Mempool process linked to the current process.
Callbacks
@callback handle_acquired(snapshop :: map(), state) :: {:ok, :next_transaction, new_state} | {:ok, new_state} | {:close, new_state} when state: term(), new_state: term()
Invoked when a new snapshot is acquired.
Receives snapshot information as argument.
Returning {:ok, :next_transaction, new_state}
will request the next transaction
once it's made available.
Returning {:ok, new_state}
wil not request anymore transactions.
Returning {:close, new_state}
will close the connection to the server.
Invoked upon connecting to the server. This callback is optional.
@callback handle_disconnect(reason :: String.t(), state) :: {:ok, new_state} | {:reconnect, interval_in_ms :: non_neg_integer(), new_state} when state: term(), new_state: term()
Invoked upon disconnecting from the server. This callback is optional.
Returning {:ok, new_state}
will allow the connection to close.
Returning {:reconnect, interval_in_ms}
will attempt a reconnection after interval_in_ms
@callback handle_transaction(transaction :: map(), state) :: {:ok, :next_transaction, new_state} | {:ok, new_state} | {:close, new_state} when state: term(), new_state: term()
Invoked when a new transaction is made available in the mempool.
Receives transaction information as argument and current state of the handler.
Returning {:ok, :next_transaction, new_state}
will request the next transaction
once it's made available.
Returning {:ok, new_state}
wil not request anymore transactions.
Returning {:close, new_state}
will close the connection to the server.
Functions
Starts a new Mempool process linked to the current process.
This function should not be called directly, but rather via Xogmios.start_mempool_txs_link/2