diff --git a/lib/peridiod/binary/installer/behaviour.ex b/lib/peridiod/binary/installer/behaviour.ex index ea95a08..85b15a4 100644 --- a/lib/peridiod/binary/installer/behaviour.ex +++ b/lib/peridiod/binary/installer/behaviour.ex @@ -12,7 +12,7 @@ defmodule Peridiod.Binary.Installer.Behaviour do end def install_update(%Peridiod.Binary{}, {:error, reason}, state) do - {:error, reason} + {:error, reason, state} end def install_finish(%Peridiod.Binary{}, :invalid_signature, state) do @@ -23,7 +23,15 @@ defmodule Peridiod.Binary.Installer.Behaviour do {:ok, installer_state} end - defoverridable install_init: 3, install_update: 3, install_finish: 3, install_info: 2 + def install_error(%Peridiod.Binary{}, error, installer_state) do + {:error, error, installer_state} + end + + defoverridable install_init: 3, + install_update: 3, + install_finish: 3, + install_info: 2, + install_error: 3 end end @@ -36,6 +44,10 @@ defmodule Peridiod.Binary.Installer.Behaviour do {:ok, installer_state()} | {:error, reason :: any(), installer_state()} @callback install_update(Binary.t(), data :: binary(), installer_state()) :: {:ok, installer_state()} | {:error, reason :: any(), installer_state()} + @callback install_info(msg :: any, installer_state()) :: + {:ok, installer_state()} | {:error, reason :: any(), installer_state()} + @callback install_error(Binary.t(), reason :: any(), installer_state()) :: + {:ok, installer_state()} | {:error, reason :: any(), installer_state()} @callback install_finish(Binary.t(), :valid_signature | :invalid_signature, installer_state()) :: {:stop, reason :: any(), installer_state()} | {:noreply, installer_state()}