View Source Finitomata.Pool.Actor behaviour (Finitomata v0.29.3)

The behaviour specifying the actor in the pool.

Summary

Callbacks

The function which would be invoked in Finitomata.Pool.run/3 after actor/2 failed with a failure message and the state of the Pool worker, see Finitomata.Pool.naive_handler/0.

The function which would be invoked in Finitomata.Pool.run/3 after actor/2 returned successfully with a result of invocation and the state of the Pool worker, see Finitomata.Pool.naive_handler/0.

Functions

StreamData helper to produce on_error/2 and on_result/2 handlers

Callbacks

actor(term, payload)

@callback actor(term(), Finitomata.State.payload()) :: {:ok, term()} | {:error, any()}

The function which would be invoked in Finitomata.Pool.run/3, see Finitomata.Pool.responsive_actor/0

on_error(error, id)

(optional)
@callback on_error(error :: term(), id :: Finitomata.Pool.id()) :: any()

The function which would be invoked in Finitomata.Pool.run/3 after actor/2 failed with a failure message and the state of the Pool worker, see Finitomata.Pool.naive_handler/0.

The value returned from this call will be send as an last argument of the message to the caller of Finitomata.Pool.run/3 if the pid was passed.

on_result(result, id)

(optional)
@callback on_result(result :: term(), id :: Finitomata.Pool.id()) :: any()

The function which would be invoked in Finitomata.Pool.run/3 after actor/2 returned successfully with a result of invocation and the state of the Pool worker, see Finitomata.Pool.naive_handler/0.

The value returned from this call will be send as an last argument of the message to the caller of Finitomata.Pool.run/3 if the pid was passed.

Functions

handler()

StreamData helper to produce on_error/2 and on_result/2 handlers

handler(f)