edeliver v1.2.6 Edeliver.Relup.ShiftInstruction

Provides functions to move relup instructions to a given position

which can be used in Edeliver.Relup.Instruction behaviour implementations in the relup file to fulfill some requirements.

Summary

Functions

Ensures that the given module is loaded before the first occurrence of the runnable instruction (if it needs to be loaded)

Ensures that the given module is loaded before the given instruction (if it needs to be loaded)

Ensures that the given module is (un)loaded after the given instruction (if it needs to be (un)loaded)

Ensures that the given module is (un)loaded after the last occurrenct of the given runnable instruction (if it needs to be (un)loaded)

Returns the first occurence of a RunnableInstruction implemented by the given module

Types

insert_fun :: (%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, new_instructions :: instruction | instructions -> updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions)
instruction :: :relup.instruction

Functions

ensure_module_loaded_before_first_runnable_instructions(instructions, arg)

Specs

ensure_module_loaded_before_first_runnable_instructions(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}) :: updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions
ensure_module_loaded_before_first_runnable_instructions(up_instructions, runnable_instruction, module)

Specs

ensure_module_loaded_before_first_runnable_instructions(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}, module :: atom) :: updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions

Ensures that the given module is loaded before the first occurrence of the runnable instruction (if it needs to be loaded).

If an %Instructions{} is given containing also the down instructions, it ensures that the module is unloaded after the last occurrence of the runnable down instruction. Use this function instead of the ensure_module_loaded_before_instruction/3 function if the RunnableInstruction can be used several times in a Relup.Modification.

ensure_module_loaded_before_instruction(instructions, instruction)
ensure_module_loaded_before_instruction(up_instructions, instruction, module)

Specs

ensure_module_loaded_before_instruction(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, instruction :: instruction, module :: atom) :: updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions

Ensures that the given module is loaded before the given instruction (if it needs to be loaded).

If an %Instructions{} is given containing also the down instructions, it ensures that the module is unloaded after the instruction for the down instructions. Use this function only, if the instruction should be used only once in a Relup.Modification for the up or down instructions. Use the ensure_module_loaded_before_first_runnable_instructions/2 function instead if the RunnableInstruction can be used several times in a Relup.Modification.

ensure_module_unloaded_after_instruction(instructions, instruction)
ensure_module_unloaded_after_instruction(up_instructions, instruction, module)

Specs

ensure_module_unloaded_after_instruction(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, instruction :: instruction, module :: atom) :: updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions

Ensures that the given module is (un)loaded after the given instruction (if it needs to be (un)loaded).

If an %Instructions{} is given containing also the down instructions, it ensures that the module is (un)loaded before the instruction for the down instructions. Use this function only, if the instruction should be used only once in a Relup.Modification for the up or down instructions. Use the ensure_module_unloaded_after_last_runnable_instruction/2 function instead if the RunnableInstruction can be used several times in a Relup.Modification.

ensure_module_unloaded_after_last_runnable_instruction(instructions, arg)
ensure_module_unloaded_after_last_runnable_instruction(up_instructions, runnable_instruction, module)

Specs

ensure_module_unloaded_after_last_runnable_instruction(%Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions, runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}}, module :: atom) :: updated_instructions :: %Edeliver.Relup.Instructions{changed_modules: term, down_instructions: term, down_version: term, up_instructions: term, up_version: term} | instructions

Ensures that the given module is (un)loaded after the last occurrenct of the given runnable instruction (if it needs to be (un)loaded).

If an %Instructions{} is given containing also the down instructions, it ensures that the module is loaded before the first occurrence of the runnable instruction for the down instructions. Use this function instead of the ensure_module_unloaded_after_instruction/3 function if the RunnableInstruction can be used several times in a Relup.Modification.

first_runnable_instruction(list, module)

Specs

first_runnable_instruction(instructions :: instructions, module :: atom) :: runnable_instruction :: {:apply, {module :: atom, :run, arguments :: [term]}} | :not_found

Returns the first occurence of a RunnableInstruction implemented by the given module.