View Source Edeliver.Relup.ShiftInstruction (edeliver v1.9.2)
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.
Link to this section Summary
Functions
Ensures that the module of Edeliver.Relup.RunnableInstruction
is loaded before it is executed.
Ensures that the given module is loaded before the first occurrence of the runnable instruction.
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 module of Edeliver.Relup.RunnableInstruction
is unloaded after it was executed.
Ensures that the given module is (un)loaded after the last occurrenct of the given runnable instruction.
Returns the first occurrence of a RunnableInstruction
implemented by the given module.
Link to this section Functions
ensure_module_loaded_before_first_runnable_instructions(instructions, runnable_instruction)
View Source@spec ensure_module_loaded_before_first_runnable_instructions( Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions(), runnable_instruction :: {:apply, {module :: module(), :run, arguments :: [term()]}} ) :: updated_instructions :: Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions()
Ensures that the module of Edeliver.Relup.RunnableInstruction
is loaded before it is executed.
E.g. if an Edeliver.Relup.Instructions.Info
instruction implements the behaviour
Edeliver.Relup.RunnableInstruction
it creates and inserts a:
{:apply, {Elixir.Edeliver.Relup.Instructions.Info, :run, ["hello"]}}
relup instruction. This function ensures that the instruction which loads
that module is placed before that instruction. This is essential if the Edeliver.Relup.RunnableInstruction
is new
and was not included into the old version of the release or has changed in the new version.
ensure_module_loaded_before_first_runnable_instructions(instructions, runnable_instruction, module)
View Source@spec ensure_module_loaded_before_first_runnable_instructions( Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions(), runnable_instruction :: {:apply, {module :: module(), :run, arguments :: [term()]}}, module :: module() ) :: updated_instructions :: Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions()
Ensures that the given module is loaded before the first occurrence of the runnable instruction.
If an %Edeliver.Relup.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 Edeliver.Relup.RunnableInstruction
can be used several times
in a Edeliver.Relup.Modification
. If the module did not change and was already included into the old release this function
has no effect.
ensure_module_loaded_before_instruction(instructions, instruction, module)
View Source@spec ensure_module_loaded_before_instruction( Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions(), instruction :: Edeliver.Relup.Instructions.instruction(), module :: module() ) :: updated_instructions :: Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions()
Ensures that the given module is loaded before the given instruction (if it needs to be loaded).
If an %Edeliver.Relup.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, module)
View Source@spec ensure_module_unloaded_after_instruction( Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions(), instruction :: Edeliver.Relup.Instructions.instruction(), module :: module() ) :: updated_instructions :: Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions()
Ensures that the given module is (un)loaded after the given instruction (if it needs to be (un)loaded).
If an %Edeliver.Relup.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, runnable_instruction)
View Source Ensures that the module of Edeliver.Relup.RunnableInstruction
is unloaded after it was executed.
E.g. if an Edeliver.Relup.Instructions.Info
instruction implements the behaviour Edeliver.Relup.RunnableInstruction
it creates and inserts a
{:apply, {Elixir.Edeliver.Relup.Instructions.Info, :run, ["hello"]}}
relup instruction. This function ensures that the instruction
which unloads that module is placed after that instruction. This is essential if the Edeliver.Relup.RunnableInstruction
was changed and the new version is unloaded in the downgrade instructions.
ensure_module_unloaded_after_last_runnable_instruction(instructions, runnable_instruction, module)
View Source@spec ensure_module_unloaded_after_last_runnable_instruction( Edeliver.Relup.Instructions.t() | Edeliver.Relup.Instructions.instructions(), runnable_instruction :: {:apply, {module :: module(), :run, arguments :: [term()]}}, module :: module() ) :: updated_instructions :: Edeliver.Relup.Instructions.t() | Instruction.instructions()
Ensures that the given module is (un)loaded after the last occurrenct of the given runnable instruction.
If an %Edeliver.Relup.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
.
@spec first_runnable_instruction( instructions :: Edeliver.Relup.Instructions.instructions(), module :: module() ) :: runnable_instruction :: {:apply, {module :: module(), :run, arguments :: [term()]}} | :not_found
Returns the first occurrence of a RunnableInstruction
implemented by the given module.