Skip to content

Module dev_patch.erl

A device that can be used to reorganize a message: Moving data from one path inside it to another.

Description

This device's function runs in two modes:

  1. When using all to move all data at the path given in from to the path given in to.
  2. When using patches to move all submessages in the source to the target, if they have a method key of PATCH or a device key of patch@1.0.

Source and destination paths may be prepended by base: or req: keys to indicate that they are relative to either of the message's that the computation is being performed on.

The search order for finding the source and destination keys is as follows, where X is either from or to:

  1. The patch-X key of the execution message.
  2. The X key of the execution message.
  3. The patch-X key of the request message.
  4. The X key of the request message.

Additionally, this device implements the standard computation device keys, allowing it to be used as an element of an execution stack pipeline, etc.

Function Index

all/3Get the value found at the patch-from key of the message, or the from key if the former is not present.
all_mode_test/0*
compute/3
init/3Necessary hooks for compliance with the execution-device standard.
move/4*Unified executor for the all and patches modes.
normalize/3
patch_to_submessage_test/0*
patches/3Find relevant PATCH messages in the given source key of the execution and request messages, and apply them to the given destination key of the request.
req_prefix_test/0*
snapshot/3
uninitialized_patch_test/0*

Function Details

all/3

all(Msg1, Msg2, Opts) -> any()

Get the value found at the patch-from key of the message, or the from key if the former is not present. Remove it from the message and set the new source to the value found.

all_mode_test/0 *

all_mode_test() -> any()

compute/3

compute(Msg1, Msg2, Opts) -> any()

init/3

init(Msg1, Msg2, Opts) -> any()

Necessary hooks for compliance with the execution-device standard.

move/4 *

move(Mode, Msg1, Msg2, Opts) -> any()

Unified executor for the all and patches modes.

normalize/3

normalize(Msg1, Msg2, Opts) -> any()

patch_to_submessage_test/0 *

patch_to_submessage_test() -> any()

patches/3

patches(Msg1, Msg2, Opts) -> any()

Find relevant PATCH messages in the given source key of the execution and request messages, and apply them to the given destination key of the request.

req_prefix_test/0 *

req_prefix_test() -> any()

snapshot/3

snapshot(Msg1, Msg2, Opts) -> any()

uninitialized_patch_test/0 *

uninitialized_patch_test() -> any()