Search documentation of Finitomata

# View Source Finitomata.Pool.Actor behaviour (Finitomata v0.22.1)

The behaviour specifying the actor in the pool.

# Summary

## Callbacks

actor(term, payload)

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

on_error(error, id)

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`.

on_result(result, id)

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

handler()

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

handler(f)

# Callbacks

Link to this callback

# actor(term, payload)

View Source

    @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`

Link to this callback

# on_error(error, id)

View Source (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.

Link to this callback

# on_result(result, id)

View Source (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

Link to this function

# handler()

View Source

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

Link to this function

# handler(f)

View Source