Kira v0.1.0 Kira.RuntimeState

Link to this section Summary

Functions

Records the fact that the process has started running, and also prevents any of the branches that depend on it from start rolling back

When you record a failure with a branch it doesn’t necessary mean this process has completely failed, as there is an oppurtunity for it to be reattmpted. But it is important for the exception to be recorded, so if a rollback is necessary we can identify the culprit that made the rollback necessary

Ensure anything that would be awaiting for this task to be rolled back is no longer blocked by the task associated with this branch_name

Link to this section Types

Link to this type branches()
branches() :: %{required(atom()) => Kira.BranchState.t()}
Link to this type running()
running() :: %{required(pid()) => atom()}
Link to this type t()
t() :: %Kira.RuntimeState{
  branch_states: branches(),
  config: any(),
  progress: Kira.Progress.t(),
  running: running(),
  timeout: timeout()
}

Link to this section Functions

Link to this function apply_done?(state)
apply_done?(state :: t()) :: boolean()
Link to this function create(config, branch_list, timeout)
create(config :: any(), branch_list :: [Kira.Branch.t()], timeout :: timeout()) ::
  Kira.Util.result(t())
Link to this function find_apply_ready(state)
find_apply_ready(state :: t()) :: MapSet.t(atom())
Link to this function find_unapply_ready(state)
find_unapply_ready(state :: t()) :: MapSet.t(atom())
Link to this function get_branch(state, branch_name)
get_branch(state :: t(), branch_name :: atom()) ::
  Kira.Util.result(Kira.BranchState.t())
Link to this function get_branch_from_pid(state, pid)
get_branch_from_pid(state :: t(), pid :: pid()) ::
  Kira.Util.result(Kira.BranchState.t())
Link to this function get_branch_pid(state, branch_name)
get_branch_pid(state :: t(), branch_name :: atom()) ::
  Kira.Util.result(pid())
Link to this function get_done(state)
get_done(state :: t()) :: %{required(atom()) => any()}
Link to this function get_errors(state)
get_errors(state :: t()) :: [any()]
Link to this function mark_as_applied(state, branch_name, value)
mark_as_applied(state :: t(), branch_name :: atom(), value :: any()) ::
  Kira.Util.result(t())
Link to this function mark_as_applying(state, branch_name, pid)
mark_as_applying(state :: t(), branch_name :: atom(), pid :: pid()) ::
  Kira.Util.result(t())

Records the fact that the process has started running, and also prevents any of the branches that depend on it from start rolling back.

Link to this function mark_as_unapplied(state, branch_name)
mark_as_unapplied(state :: t(), branch_name :: atom()) ::
  Kira.Util.result(t())
Link to this function record_apply_retry(state, branch_name, pid)
record_apply_retry(state :: t(), branch_name :: atom(), pid :: pid()) ::
  Kira.Util.result(t())
Link to this function record_failure(state, branch_name, error)
record_failure(state :: t(), branch_name :: atom(), error :: any()) ::
  Kira.Util.result(t())

When you record a failure with a branch it doesn’t necessary mean this process has completely failed, as there is an oppurtunity for it to be reattmpted. But it is important for the exception to be recorded, so if a rollback is necessary we can identify the culprit that made the rollback necessary.

Link to this function resolve_dependencies_of(state, branch_name)
resolve_dependencies_of(state :: t(), branch_name :: atom()) ::
  Kira.Util.result(map())
Link to this function runtime_state_error(error)
Link to this function set_branch_task(state, branch_name, task)
set_branch_task(
  state :: t(),
  branch_name :: atom(),
  task :: Kira.BranchState.task()
) :: Kira.Util.result(t())
Link to this function unapply_done?(state)
unapply_done?(state :: t()) :: boolean()
Link to this function unblock_dependend_unapplys(state, branch_name)
unblock_dependend_unapplys(state :: t(), branch_name :: atom()) ::
  Kira.Util.result(t())

Ensure anything that would be awaiting for this task to be rolled back is no longer blocked by the task associated with this branch_name.