Current section
Files
Jump to
Current section
Files
src/aion@workflow@define.erl
-module(aion@workflow@define).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/aion/workflow/define.gleam").
-export([define/5, name/1, input_codec/1, output_codec/1, error_codec/1, entry_fn/1]).
-export_type([workflow_definition/3]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(" workflow.define: typed entry contract (entry fn + input/output/error codecs)\n").
-opaque workflow_definition(EYH, EYI, EYJ) :: {workflow_definition,
binary(),
aion@codec:codec(EYH),
aion@codec:codec(EYI),
aion@codec:codec(EYJ),
fun((EYH) -> {ok, EYI} | {error, EYJ})}.
-file("src/aion/workflow/define.gleam", 29).
?DOC(" Define a typed workflow entry contract consumed by AE at spawn.\n").
-spec define(
binary(),
aion@codec:codec(EYK),
aion@codec:codec(EYM),
aion@codec:codec(EYO),
fun((EYK) -> {ok, EYM} | {error, EYO})
) -> workflow_definition(EYK, EYM, EYO).
define(Name, Input_codec, Output_codec, Error_codec, Entry_fn) ->
{workflow_definition,
Name,
Input_codec,
Output_codec,
Error_codec,
Entry_fn}.
-file("src/aion/workflow/define.gleam", 46).
?DOC(" Return the workflow name carried by the definition.\n").
-spec name(workflow_definition(any(), any(), any())) -> binary().
name(Definition) ->
erlang:element(2, Definition).
-file("src/aion/workflow/define.gleam", 51).
?DOC(" Return the input codec used by AE to decode the spawn Payload.\n").
-spec input_codec(workflow_definition(EZB, any(), any())) -> aion@codec:codec(EZB).
input_codec(Definition) ->
erlang:element(3, Definition).
-file("src/aion/workflow/define.gleam", 58).
?DOC(" Return the output codec used by AE to encode successful completion Payloads.\n").
-spec output_codec(workflow_definition(any(), EZJ, any())) -> aion@codec:codec(EZJ).
output_codec(Definition) ->
erlang:element(4, Definition).
-file("src/aion/workflow/define.gleam", 65).
?DOC(" Return the error codec used by AE to encode failed completion Payloads.\n").
-spec error_codec(workflow_definition(any(), any(), EZR)) -> aion@codec:codec(EZR).
error_codec(Definition) ->
erlang:element(5, Definition).
-file("src/aion/workflow/define.gleam", 72).
?DOC(" Return the typed entry function carried for AE to invoke/drive.\n").
-spec entry_fn(workflow_definition(EZW, EZX, EZY)) -> fun((EZW) -> {ok, EZX} |
{error, EZY}).
entry_fn(Definition) ->
erlang:element(6, Definition).