temporal_sdk_workflow behaviour (temporal_sdk v0.1.14)
View SourceTemporal operator services module.
WIP. Module will provide following Temporal services:
add_search_attributes
remove_search_attributes
list_search_attributes
register_namespace
list_namespaces
describe_namespace
update_namespace
delete_namespace
'GetNexusEndpoint'
'CreateNexusEndpoint'
'UpdateNexusEndpoint'
'DeleteNexusEndpoint'
'ListNexusEndpoints'
'ListWorkers'
'FetchWorkerConfig'
'UpdateWorkerConfig'
'DescribeWorker'
'UpdateTaskQueueConfig'
'AddOrUpdateRemoteCluster'
'RemoveRemoteCluster'
'ListClusters'
Summary
Awaitables functions
-spec await(AwaitPattern :: await_pattern()) -> await_ret().
-spec await(AwaitPattern :: await_pattern(), Timeout :: temporal_sdk:time()) -> await_ret().
-spec await_all(AwaitPattern :: [await_pattern()]) -> await_ret_list().
-spec await_all(AwaitPattern :: [await_pattern()], Timeout :: temporal_sdk:time()) -> await_ret_list().
-spec await_info(InfoOrInfoId :: info() | term(), InfoTimeout :: temporal_sdk:time(), AwaitableTimeout :: temporal_sdk:time()) -> await_ret() | noinfo.
-spec await_one(AwaitPattern :: [await_pattern()]) -> await_ret_list().
-spec await_one(AwaitPattern :: [await_pattern()], Timeout :: temporal_sdk:time()) -> await_ret_list().
-spec is_awaited(AwaitPattern :: await_pattern()) -> {true, await_match()} | {false, await_match()} | no_return.
-spec is_awaited_all(AwaitPattern :: [await_pattern()]) -> {true, [await_match()]} | {false, [await_match()]} | no_return.
-spec is_awaited_one(AwaitPattern :: [await_pattern()]) -> {true, [await_match()]} | {false, [await_match()]} | no_return.
-spec wait(AwaitPattern :: await_pattern()) -> await_match() | no_return().
-spec wait(AwaitPattern :: await_pattern(), Timeout :: temporal_sdk:time()) -> await_match() | no_return().
-spec wait_all(AwaitPattern :: [await_pattern()]) -> [await_match()] | no_return().
-spec wait_all(AwaitPattern :: [await_pattern()], Timeout :: temporal_sdk:time()) -> [await_match()] | no_return().
-spec wait_info(InfoOrInfoId :: info() | term()) -> await_match() | no_return().
-spec wait_info(InfoOrInfoId :: info() | term(), InfoTimeout :: temporal_sdk:time(), AwaitableTimeout :: temporal_sdk:time()) -> await_match() | no_return().
-spec wait_one(AwaitPattern :: [await_pattern()]) -> [await_match()] | no_return().
-spec wait_one(AwaitPattern :: [await_pattern()], Timeout :: temporal_sdk:time()) -> [await_match()] | no_return().
Awaitables functions types
-type await_match() :: awaitable_match() | await_match_all() | await_match_one().
-type await_match_all() :: {all, [awaitable_match() | await_match_one() | await_match_all()]}.
-type await_match_one() :: {one, [awaitable_match() | await_match_one() | await_match_all()]}.
-type await_pattern() :: awaitable_pattern() | await_pattern_all() | await_pattern_one().
-type await_pattern_all() :: {all, [awaitable_pattern() | await_pattern_one() | await_pattern_all()]}.
-type await_pattern_one() :: {one, [awaitable_pattern() | await_pattern_one() | await_pattern_all()]}.
-type await_ret() :: {ok, await_match()} | {noevent, PartialMatch :: await_match()} | no_return().
-type await_ret_list() :: {ok, [await_match()]} | {noevent, [ProperOrPartialMatch :: await_match()]} | no_return().
-type awaitable_match() :: awaitable_data() | info_data() | noevent.
-type awaitable_pattern() :: awaitable_data() | info_pattern() | execution_pattern() | suggest_continue_as_new_pattern() | activity_pattern() | marker_pattern() | timer_pattern() | child_workflow_pattern() | nexus_pattern() | workflow_properties_pattern() | cancel_request_pattern() | signal_pattern() | query_pattern() | history_event_event_pattern().
Awaitables types
-type activity() :: {activity_event(), ActivityId :: unicode:chardata()}.
-type activity_data() :: #{state := cmd, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_to_payloads(), last_failure => temporal_sdk_telemetry:exception(), heartbeat_timeout => pos_integer(), cancel_requested => true, history => [map()]} | #{state := scheduled, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_to_payloads(), last_failure => temporal_sdk_telemetry:exception(), heartbeat_timeout => pos_integer(), cancel_requested => true, history => [map()]} | #{state := started, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_to_payloads(), last_failure => temporal_sdk_telemetry:exception() | temporal_sdk:failure_from_temporal(), heartbeat_timeout => pos_integer(), cancel_requested => true, scheduled_event_id := event_id(), history => [map()]} | #{state := completed, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_from_payloads(), last_failure => temporal_sdk_telemetry:exception() | temporal_sdk:failure_from_temporal(), heartbeat_timeout => pos_integer(), cancel_requested => true, scheduled_event_id := event_id(), started_event_id := event_id(), attempt := pos_integer(), history => [map()]} | #{state := canceled, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_to_payloads(), last_failure => temporal_sdk_telemetry:exception() | temporal_sdk:failure_from_temporal(), heartbeat_timeout => pos_integer(), cancel_requested := true, scheduled_event_id := event_id(), started_event_id := event_id(), attempt := pos_integer(), details := temporal_sdk:term_from_payloads(), history => [map()]} | #{state := failed, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_to_payloads(), last_failure => temporal_sdk_telemetry:exception() | temporal_sdk:failure_from_temporal(), heartbeat_timeout => pos_integer(), cancel_requested => true, scheduled_event_id := event_id(), started_event_id := event_id(), failure => temporal_sdk:failure_from_temporal(), retry_state := temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.RetryState'(), history => [map()]} | #{state := timedout, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), activity_type := unicode:chardata() | atom(), session_execution := boolean(), eager_execution := boolean(), direct_execution := boolean(), direct_result := boolean(), result => temporal_sdk:term_to_payloads(), last_failure => temporal_sdk_telemetry:exception() | temporal_sdk:failure_from_temporal(), heartbeat_timeout => pos_integer(), cancel_requested => true, scheduled_event_id := event_id(), started_event_id := event_id(), failure => temporal_sdk:failure_from_temporal(), retry_state := temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.RetryState'(), history => [map()]}.
-type activity_event() ::
activity_cmd | activity_cancel_request | activity_result | activity_schedule |
activity_start | activity.
-type activity_index_key() :: {activity, ActivityId :: unicode:chardata()}.
-type activity_index_key_pattern() :: {activity, ets_matchvar() | (ActivityId :: unicode:chardata())}.
-type activity_pattern() :: {activity_event(), '_' | (ActivityId :: unicode:chardata() | atom())}.
-type awaitable() :: info() | execution() | suggest_continue_as_new() | activity() | marker() | timer() | child_workflow() | nexus() | workflow_properties() | complete_workflow_execution() | cancel_workflow_execution() | fail_workflow_execution() | continue_as_new_workflow() | cancel_request() | signal() | query() | history_event().
-type awaitable_data() :: execution_data() | suggest_continue_as_new_data() | activity_data() | marker_data() | timer_data() | child_workflow_data() | nexus_data() | workflow_properties_data() | complete_workflow_execution_data() | cancel_workflow_execution_data() | fail_workflow_execution_data() | continue_as_new_workflow_data() | cancel_request_data() | signal_data() | query_data() | event_data().
-type awaitable_state() ::
cmd | scheduled | started | canceled | completed | failed | initiated | initiate_failed |
fired | modified | recorded | continued | requested | signaled | responded | suggested |
admitted.
-type cancel_request() :: {cancel_request_event()}.
-type cancel_request_data() :: #{state := requested, event_id := event_id(), cause => unicode:chardata(), external_initiated_event_id => pos_integer(), external_workflow_execution => temporal_sdk:workflow_execution(), identity => unicode:chardata()}.
-type cancel_request_event() :: cancel_request.
-type cancel_request_index_key() :: {cancel_request}.
-type cancel_request_index_key_pattern() :: {cancel_request}.
-type cancel_request_pattern() :: {cancel_request_event()}.
-type cancel_workflow_execution() :: {cancel_workflow_execution}.
-type cancel_workflow_execution_data() :: #{state := cmd, execution_id := execution_id(), details := temporal_sdk:term_to_payloads()} | #{state := canceled, execution_id := execution_id(), event_id := event_id(), details := temporal_sdk:term_from_payloads()}.
-type cancel_workflow_execution_index_key() :: {cancel_workflow_execution}.
-type cancel_workflow_execution_index_key_pattern() :: {cancel_workflow_execution}.
-type child_workflow() :: {child_workflow_event(), ChildWorkflowId :: unicode:chardata()}.
-type child_workflow_data() :: #{state := cmd, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()]} | #{state := initiated, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()]} | #{state := initiate_failed, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), cause := temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.StartChildWorkflowExecutionFailedCause'()} | #{state := started, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), run_id := unicode:chardata()} | #{state := completed, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), run_id := unicode:chardata(), started_event_id := event_id(), result := temporal_sdk:term_from_payloads()} | #{state := failed, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), run_id := unicode:chardata(), started_event_id := event_id(), failure => temporal_sdk:failure_from_temporal()} | #{state := canceled, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), run_id := unicode:chardata(), started_event_id := event_id(), details := temporal_sdk:term_from_payloads()} | #{state := timedout, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), run_id := unicode:chardata(), started_event_id := event_id(), retry_state := temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.RetryState'()} | #{state := terminated, execution_id := execution_id(), event_id := event_id(), namespace := unicode:chardata(), task_queue := unicode:chardata(), workflow_type := unicode:chardata() | atom(), history => [map()], initiated_event_id := event_id(), run_id := unicode:chardata(), started_event_id := event_id()}.
-type child_workflow_event() ::
[child_workflow_cmd | child_workflow_initiate | child_workflow_start | child_workflow].
-type child_workflow_index_key() :: {child_workflow, ChildWorkflowId :: unicode:chardata()}.
-type child_workflow_index_key_pattern() :: {child_workflow, ets_matchvar() | (ChildWorkflowId :: unicode:chardata())}.
-type child_workflow_pattern() :: {child_workflow_event(), '_' | (ChildWorkflowId :: unicode:chardata())}.
-type complete_workflow_execution() :: {complete_workflow_execution}.
-type complete_workflow_execution_data() :: #{state := cmd, execution_id := execution_id() | undefined, event_id => event_id(), result := temporal_sdk:term_to_payloads()} | #{state := completed, execution_id := execution_id() | undefined, event_id := event_id(), result := temporal_sdk:term_from_payloads()}.
-type complete_workflow_execution_index_key() :: {complete_workflow_execution}.
-type complete_workflow_execution_index_key_pattern() :: {complete_workflow_execution}.
-type continue_as_new_workflow() :: {continue_as_new_workflow}.
-type continue_as_new_workflow_data() :: #{state := cmd, execution_id := execution_id(), task_queue := unicode:chardata(), workflow_type := unicode:chardata()} | #{state := continued, execution_id := execution_id(), event_id := event_id(), task_queue := unicode:chardata(), workflow_type := unicode:chardata()}.
-type continue_as_new_workflow_index_key() :: {continue_as_new_workflow}.
-type continue_as_new_workflow_index_key_pattern() :: {continue_as_new_workflow}.
-type event_data() :: #{event_id := event_id(), type := temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.EventType'(), attributes := map(), data := map()}.
-type event_id() :: pos_integer().
-type execution() :: {execution_event(), ExecutionId :: execution_id()}.
-type execution_data() :: #{state := cmd, mfa := {Module :: module(), Function :: atom(), Args :: term()}} | #{state := started, mfa := {Module :: module(), Function :: atom(), Args :: term()}} | #{state := completed, mfa := {Module :: module(), Function :: atom(), Args :: term()}, result => execution_result()}.
-type execution_event() :: execution_cmd | execution_start | execution.
-type execution_id() :: term().
-type execution_index_key() :: {execution, ExecutionId :: execution_id()}.
-type execution_index_key_pattern() :: {execution, ets_matchvar() | (ExecutionId :: execution_id())}.
-type execution_pattern() :: {execution_event(), '_' | (ExecutionId :: execution_id())}.
-type execution_result() :: term().
-type fail_workflow_execution() :: {fail_workflow_execution}.
-type fail_workflow_execution_data() :: #{state := cmd, execution_id := execution_id(), failure := temporal_sdk:application_failure() | temporal_sdk:user_application_failure()} | #{state := failed, execution_id := execution_id(), event_id := event_id(), failure := temporal_sdk:failure_from_temporal()}.
-type fail_workflow_execution_index_key() :: {fail_workflow_execution}.
-type fail_workflow_execution_index_key_pattern() :: {fail_workflow_execution}.
-type history_event() :: {EventId :: event_id(), EventType :: temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.EventType'(), EventAttributes :: map(), EventData :: map()}.
-type history_event_event_pattern() :: {event, history_event_pattern()}.
-type history_event_pattern() :: {'_' | (EventId :: event_id()), '_' | (EventType :: temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.EventType'()), '_' | (EventAttributes :: map()), '_' | (EventData :: map())}.
-type history_event_table_pattern() :: {ets_matchvar() | (EventId :: event_id()), ets_matchvar() | (EventType :: temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.EventType'()), ets_matchvar() | (EventAttributes :: map()), ets_matchvar() | (EventData :: map())}.
-type history_event_table_pattern_match_spec() :: [{EtsMatchHead :: history_event_table_pattern(), EtsMatchGuard :: [_], EtsMatchResult :: [_]}].
-type info() :: {info, InfoId :: term()}.
-type info_index_key() :: {info, InfoId :: term()}.
-type info_index_key_pattern() :: {info, ets_matchvar() | (InfoId :: term())}.
-type info_pattern() :: {info, '_' | (InfoId :: term())}.
-type marker() :: {marker_event(), MarkerType :: unicode:chardata() | atom(), MarkerName :: unicode:chardata() | atom()}.
-type marker_data() :: #{state := cmd, execution_id := execution_id(), event_id := event_id(), mutable => true, mutations_count => non_neg_integer(), details := temporal_sdk:term_to_mapstring_payload(), value => temporal_sdk:term_to_payloads() | term(), history => [map()]} | #{state := recorded, execution_id := execution_id(), event_id := event_id(), mutable => true, mutations_count => non_neg_integer(), details := temporal_sdk:term_from_mapstring_payload(), value := temporal_sdk:term_from_payloads() | term(), history => [map()]} | #{state := recorded, execution_id := undefined, event_id := event_id(), value := temporal_sdk:term_from_payloads(), history => [map()]}.
-type marker_event() :: marker_cmd | marker_value | marker.
-type marker_index_key() :: {marker, MarkerType :: unicode:chardata(), MarkerName :: unicode:chardata()}.
-type marker_index_key_pattern() :: {marker, ets_matchvar() | (MarkerType :: unicode:chardata() | atom()), ets_matchvar() | (MarkerName :: unicode:chardata() | atom())}.
-type marker_pattern() :: {marker_event(), '_' | (MarkerType :: unicode:chardata() | atom()), '_' | (MarkerName :: unicode:chardata() | atom())}.
-type nexus() :: {nexus_event(), Endpoint :: unicode:chardata() | atom(), Service :: unicode:chardata() | atom(), Operation :: unicode:chardata() | atom()}.
-type nexus_data() :: #{state := cmd, execution_id := execution_id(), event_id := event_id(), input := temporal_sdk:term_to_payload(), cancel_requested => true, history => [map()]} | #{state := scheduled, execution_id := execution_id(), event_id := event_id(), input := temporal_sdk:term_from_payload(), cancel_requested => true, history => [map()]} | #{state := started, execution_id := execution_id(), event_id := event_id(), input := temporal_sdk:term_from_payload(), cancel_requested => true, history => [map()]} | #{state := completed, execution_id := execution_id(), event_id := event_id(), input := temporal_sdk:term_from_payload(), result => temporal_sdk:term_from_payload(), cancel_requested => true, history => [map()]} | #{state := canceled, execution_id := execution_id(), event_id := event_id(), input := temporal_sdk:term_from_payload(), failure => temporal_sdk_proto_service_workflow_binaries:'temporal.api.failure.v1.Failure'(), cancel_requested := true, history => [map()]}.
-type nexus_event() :: nexus_cmd | nexus_cancel_request | nexus_schedule | nexus_start | nexus.
-type nexus_index_key() :: {nexus, Endpoint :: unicode:chardata(), Service :: unicode:chardata(), Operation :: unicode:chardata()}.
-type nexus_index_key_pattern() :: {nexus, ets_matchvar() | (Endpoint :: unicode:chardata()), ets_matchvar() | (Service :: unicode:chardata()), ets_matchvar() | (Operation :: unicode:chardata())}.
-type nexus_pattern() :: {nexus_event(), '_' | (Endpoint :: unicode:chardata() | atom()), '_' | (Service :: unicode:chardata() | atom()), '_' | (Operation :: unicode:chardata() | atom())}.
-type query() :: {query_event(), QueryType :: unicode:chardata()}.
-type query_data() :: #{'_sdk_data' := term(), state := requested, query_args => temporal_sdk:term_from_payloads(), header => temporal_sdk:term_from_mapstring_payload(), history => [map()]} | #{state := responded, query_args => temporal_sdk:term_from_payloads(), header => temporal_sdk:term_from_mapstring_payload(), answer => temporal_sdk:term_to_payloads(), error_message => unicode:chardata(), failure => temporal_sdk:application_failure() | temporal_sdk:user_application_failure(), history => [map()]}.
-type query_event() :: query_request | query_response | query.
-type query_index_key() :: {query, QueryType :: unicode:chardata()}.
-type query_index_key_pattern() :: {query, ets_matchvar() | (QueryType :: unicode:chardata())}.
-type query_pattern() :: {query_event(), '_' | (QueryType :: unicode:chardata())}.
-type signal() :: {signal_event(), SignalName :: unicode:chardata()}.
-type signal_data() :: #{state := requested, event_id := event_id(), input := temporal_sdk:term_from_payloads(), identity := unicode:chardata(), header := temporal_sdk:term_from_mapstring_payload(), external_workflow_execution => temporal_sdk:workflow_execution(), history => [map()]} | #{state := admitted, event_id := event_id(), input := temporal_sdk:term_from_payloads(), identity := unicode:chardata(), header := temporal_sdk:term_from_mapstring_payload(), external_workflow_execution => temporal_sdk:workflow_execution(), details => term(), history => [map()]}.
-type signal_event() :: signal_request | signal_admit | signal.
-type signal_index_key() :: {signal, SignalName :: unicode:chardata()}.
-type signal_index_key_pattern() :: {signal, ets_matchvar() | (SignalName :: unicode:chardata())}.
-type signal_pattern() :: {signal_event(), '_' | (SignalName :: unicode:chardata())}.
-type suggest_continue_as_new() :: {suggest_continue_as_new}.
-type suggest_continue_as_new_data() :: #{state := suggested, event_id := event_id()}.
-type suggest_continue_as_new_index_key() :: {suggest_continue_as_new}.
-type suggest_continue_as_new_index_key_pattern() :: {suggest_continue_as_new}.
-type suggest_continue_as_new_pattern() :: {suggest_continue_as_new}.
-type timer() :: {timer_event(), TimerId :: unicode:chardata() | atom()}.
-type timer_data() :: #{state := cmd, execution_id := execution_id(), event_id := event_id(), cancel_requested => true, history => [map()]} | #{state := started, execution_id := execution_id(), event_id := event_id(), cancel_requested => true, history => [map()]} | #{state := fired, execution_id := execution_id(), event_id := event_id(), started_event_id := event_id(), cancel_requested => true, history => [map()]} | #{state := canceled, execution_id := execution_id(), event_id := event_id(), started_event_id := event_id(), cancel_requested := true, history => [map()]}.
-type timer_event() :: timer_cmd | timer_cancel_request | timer_start | timer.
-type timer_index_key() :: {timer, TimerId :: unicode:chardata()}.
-type timer_index_key_pattern() :: {timer, ets_matchvar() | (TimerId :: unicode:chardata())}.
-type timer_pattern() :: {timer_event(), '_' | (TimerId :: unicode:chardata() | atom())}.
-type workflow_properties() :: {workflow_properties_event()}.
-type workflow_properties_data() :: #{state := cmd, execution_id := execution_id(), event_id := event_id(), upserted_memo := temporal_sdk:term_to_mapstring_payload(), history => [map()]} | #{state := modified, execution_id := execution_id(), event_id := event_id(), upserted_memo := temporal_sdk:term_from_mapstring_payload(), history => [map()]}.
-type workflow_properties_event() :: workflow_properties_cmd | workflow_properties.
-type workflow_properties_index_key() :: {workflow_properties}.
-type workflow_properties_index_key_pattern() :: {workflow_properties}.
-type workflow_properties_pattern() :: {workflow_properties_event()}.
SDK functions
-spec await_open_before_close(IsEnabled :: boolean()) -> ok.
-spec get_workflow_result() -> temporal_sdk:term_to_payloads() | no_return().
-spec select_history(EventId :: pos_integer()) -> history_event() | noevent; (HistoryEventPattern :: history_event_table_pattern()) -> [history_event()]; (HistoryPatternSpec :: history_event_table_pattern_match_spec()) -> [history_event()]; (Continuation :: ets_continuation()) -> {[history_event()], Continuation :: ets_continuation()} | '$end_of_table'.
-spec select_history(HistoryPatternSpec :: history_event_table_pattern_match_spec(), Limit :: pos_integer()) -> {[history_event()], Continuation :: ets_continuation()} | '$end_of_table'.
-spec select_index(AwaitableIndexPattern :: awaitable_index_pattern()) -> [awaitable_index()]; (IndexPatternSpec :: awaitable_index_pattern_match_spec()) -> [awaitable_index()]; (Continuation :: ets_continuation()) -> {[awaitable_index()], Continuation :: ets_continuation()} | '$end_of_table'.
-spec select_index(IndexPatternSpec :: awaitable_index_pattern_match_spec(), Limit :: pos_integer()) -> {[awaitable_index()], Continuation :: ets_continuation()} | '$end_of_table'.
-spec set_info(InfoValue :: term(), Opts :: [{info_id, execution_id()} | {awaitable_id, awaitable_id()}]) -> info() | no_return().
-spec set_workflow_result(WorkflowResult :: temporal_sdk:term_to_payloads()) -> ok.
-spec start_execution(Function :: atom(), Input :: term(), Opts :: start_execution_opts()) -> execution() | no_return().
-spec start_execution(Module :: module(), Function :: atom(), Input :: term(), Opts :: start_execution_opts()) -> execution() | execution_data() | no_return().
-spec stop() -> ok.
-spec stop(Reason :: term()) -> ok.
-spec workflow_info() -> workflow_info() | no_return().
SDK functions types
-type awaitable_index() :: awaitable_temporal_index() | {info_index_key(), info_data()} | {execution_index_key(), execution_data()} | {suggest_continue_as_new_index_key(), suggest_continue_as_new_data()}.
-type awaitable_index_pattern() :: {info_index_key_pattern(), ets_matchvar() | term()} | {execution_index_key_pattern(), ets_matchvar() | map()} | {suggest_continue_as_new_index_key_pattern(), ets_matchvar() | map()} | {activity_index_key_pattern(), ets_matchvar() | map()} | {marker_index_key_pattern(), ets_matchvar() | map()} | {timer_index_key_pattern(), ets_matchvar() | map()} | {child_workflow_index_key_pattern(), ets_matchvar() | map()} | {nexus_index_key_pattern(), ets_matchvar() | map()} | {workflow_properties_index_key_pattern(), ets_matchvar() | map()} | {complete_workflow_execution_index_key_pattern(), ets_matchvar() | map()} | {cancel_workflow_execution_index_key_pattern(), ets_matchvar() | map()} | {fail_workflow_execution_index_key_pattern(), ets_matchvar() | map()} | {continue_as_new_workflow_index_key_pattern(), ets_matchvar() | map()} | {cancel_request_index_key_pattern(), ets_matchvar() | map()} | {signal_index_key_pattern(), ets_matchvar() | map()} | {query_index_key_pattern(), ets_matchvar() | map()}.
-type awaitable_index_pattern_match_spec() :: [{EtsMatchHead :: awaitable_index_pattern(), EtsMatchGuard :: [_], EtsMatchResult :: [_]}].
-type awaitable_temporal_index() :: {activity_index_key(), activity_data()} | {marker_index_key(), marker_data()} | {timer_index_key(), timer_data()} | {child_workflow_index_key(), child_workflow_data()} | {nexus_index_key(), nexus_data()} | {workflow_properties_index_key(), workflow_properties_data()} | {complete_workflow_execution_index_key(), complete_workflow_execution_data()} | {cancel_workflow_execution_index_key(), cancel_workflow_execution_data()} | {fail_workflow_execution_index_key(), fail_workflow_execution_data()} | {continue_as_new_workflow_index_key(), continue_as_new_workflow_data()} | {cancel_request_index_key(), cancel_request_data()} | {signal_index_key(), signal_data()} | {query_index_key(), query_data()}.
-type ets_matchvar() :: '_' | '$1' | '$2' | '$3' | '$4' | atom().
-type start_execution_opts() :: [{execution_id, execution_id()} | {awaitable_id, awaitable_id()} | {awaitable_event, [cmd | close]} | {wait, boolean()} | wait].
-type workflow_info() :: #{event_id := pos_integer(), is_replaying := boolean(), open_executions_count := pos_integer(), open_tasks_count := non_neg_integer(), attempt := pos_integer(), suggest_continue_as_new := boolean(), history_size_bytes := non_neg_integer(), otp_messages_count := #{received => non_neg_integer(), recorded => non_neg_integer(), ignored => non_neg_integer()}}.
Temporal commands
-spec cancel_activity(ActivityOrActivityData :: activity() | activity_data()) -> activity() | no_return().
-spec cancel_activity(ActivityOrActivityData :: activity() | activity_data(), Opts :: [{awaitable_event, [cmd | cancel_request | result | schedule | start | close]} | {wait, boolean()} | wait]) -> activity() | activity_data() | no_return().
-spec cancel_timer(TimerOrTimerDataOrTimerId :: timer() | timer_data() | unicode:chardata() | atom()) -> timer() | no_return().
-spec cancel_timer(TimerOrTimerDataOrTimerId :: timer() | timer_data() | unicode:chardata() | atom(), Opts :: [{awaitable_event, [cmd | cancel_request | result | schedule | start | close]} | {wait, boolean()} | wait]) -> timer() | timer_data() | no_return().
-spec cancel_workflow_execution(Details :: temporal_sdk:term_to_payloads()) -> cancel_workflow_execution().
-spec complete_workflow_execution(Result :: temporal_sdk:term_to_payloads()) -> complete_workflow_execution().
-spec continue_as_new_workflow(TaskQueue :: unicode:chardata(), WorkflowType :: atom() | unicode:chardata()) -> continue_as_new_workflow().
-spec continue_as_new_workflow(TaskQueue :: unicode:chardata(), WorkflowType :: atom() | unicode:chardata(), Opts :: continue_as_new_workflow_opts()) -> continue_as_new_workflow().
-spec fail_workflow_execution(ApplicationFailure :: temporal_sdk:application_failure() | temporal_sdk:user_application_failure()) -> fail_workflow_execution().
-spec modify_workflow_properties(UpsertedMemoFields :: temporal_sdk:term_to_mapstring_payload()) -> workflow_properties() | no_return().
-spec modify_workflow_properties(UpsertedMemoFields :: temporal_sdk:term_to_mapstring_payload(), Opts :: [{awaitable_event, [cmd | close]} | {wait, boolean()} | wait]) -> workflow_properties() | workflow_properties_data() | no_return().
-spec record_marker(MarkerValueFun :: record_marker_value_fun()) -> marker() | no_return().
-spec record_marker(MarkerValueFun :: record_marker_value_fun(), Opts :: record_marker_opts()) -> marker() | marker_data() | no_return().
-spec start_activity(ActivityType :: unicode:chardata() | atom(), Input :: temporal_sdk:term_to_payloads()) -> activity() | no_return().
-spec start_activity(ActivityType :: unicode:chardata() | atom(), Input :: temporal_sdk:term_to_payloads(), Opts :: start_activity_opts()) -> activity() | activity_data() | no_return().
-spec start_child_workflow(TaskQueue :: unicode:chardata(), WorkflowType :: atom() | unicode:chardata()) -> child_workflow() | child_workflow_data() | no_return().
-spec start_child_workflow(TaskQueue :: unicode:chardata(), WorkflowType :: atom() | unicode:chardata(), Opts :: start_child_workflow_opts()) -> child_workflow() | child_workflow_data() | no_return().
-spec start_nexus(Endpoint :: atom() | unicode:chardata(), Service :: atom() | unicode:chardata(), Operation :: atom() | unicode:chardata(), Input :: temporal_sdk:term_to_payload()) -> nexus().
-spec start_nexus(Endpoint :: atom() | unicode:chardata(), Service :: atom() | unicode:chardata(), Operation :: atom() | unicode:chardata(), Input :: temporal_sdk:term_to_payload(), Opts :: start_nexus_opts()) -> nexus().
-spec start_timer(StartToFireTimeout :: temporal_sdk:time()) -> timer() | no_return().
-spec start_timer(StartToFireTimeout :: temporal_sdk:time(), Opts :: start_timer_opts()) -> timer() | timer_data() | no_return().
Temporal commands opts
-type awaitable_id() :: #{id => unicode:chardata() | atom(), prefix => boolean() | unicode:chardata() | atom(), postfix => boolean() | unicode:chardata() | atom()} | unicode:chardata() | atom().
-type continue_as_new_workflow_opts() :: [{input, temporal_sdk:term_to_payloads()} | {workflow_run_timeout, temporal_sdk:time()} | {workflow_task_timeout, temporal_sdk:time()} | {backoff_start_interval, temporal_sdk:time()} | {retry_policy, temporal_sdk:retry_policy()} | {header, temporal_sdk:term_to_mapstring_payload()} | {memo, temporal_sdk:term_to_mapstring_payload()} | {search_attributes, temporal_sdk:term_to_mapstring_payload()}].
-type marker_value_codec() :: none | list | term | {Encoder :: none | fun((term()) -> temporal_sdk:term_to_payloads()) | {Module :: module(), Function :: atom()}, Decoder :: none | fun((temporal_sdk:term_from_payloads()) -> term()) | {Module :: module(), Function :: atom()}}.
-type record_marker_mutable_opts() :: #{mutations_limit := pos_integer(), fail_on_limit := boolean()} | boolean().
-type record_marker_opts() :: [{marker_name, atom() | unicode:chardata()} | {header, temporal_sdk:term_to_mapstring_payload()} | {awaitable_id, awaitable_id()} | {awaitable_event, [cmd | value | close]} | {wait, boolean()} | wait | {type, temporal_sdk:convertable()} | {details, temporal_sdk:term_to_mapstring_payloads()} | {mutable, record_marker_mutable_opts()} | mutable | {value_codec, marker_value_codec()}].
-type start_activity_opts() :: [{activity_id, unicode:chardata() | atom()} | {task_queue, unicode:chardata()} | {header, temporal_sdk:term_to_mapstring_payload()} | {schedule_to_close_timeout, temporal_sdk:time()} | {schedule_to_start_timeout, temporal_sdk:time()} | {start_to_close_timeout, temporal_sdk:time()} | {heartbeat_timeout, temporal_sdk:time()} | {retry_policy, temporal_sdk:retry_policy()} | {eager_execution, boolean()} | eager_execution | {use_workflow_build_id, boolean()} | use_workflow_build_id | {priority, temporal_sdk_proto_service_workflow_binaries:'temporal.api.common.v1.Priority'()} | {raw_request, temporal_sdk_proto_service_workflow_binaries:'temporal.api.command.v1.ScheduleActivityTaskCommandAttributes'()} | {awaitable_id, awaitable_id()} | {awaitable_event, [cmd | cancel_request | result | schedule | start | close]} | {wait, boolean()} | wait | {direct_execution, boolean()} | direct_execution | {direct_result, boolean()} | direct_result | {session_execution, boolean()} | session_execution | {node_execution_fun, function()}].
-type start_child_workflow_opts() :: [{namespace, unicode:chardata()} | {workflow_id, unicode:chardata()} | {input, temporal_sdk:term_to_payloads()} | {workflow_execution_timeout, temporal_sdk:time()} | {workflow_run_timeout, temporal_sdk:time()} | {workflow_task_timeout, temporal_sdk:time()} | {parent_close_policy, temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.ParentClosePolicy'()} | {workflow_id_reuse_policy, temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.WorkflowIdReusePolicy'()} | {retry_policy, temporal_sdk:retry_policy()} | {cron_schedule, unicode:chardata()} | {header, temporal_sdk:term_to_mapstring_payload()} | {memo, temporal_sdk:term_to_mapstring_payload()} | {search_attributes, temporal_sdk:term_to_mapstring_payload()} | {priority, temporal_sdk_proto_service_workflow_binaries:'temporal.api.common.v1.Priority'()} | {raw_request, temporal_sdk_proto_service_workflow_binaries:'temporal.api.command.v1.ScheduleActivityTaskCommandAttributes'()} | {awaitable_id, awaitable_id()} | {awaitable_event, [cmd | initiate | start | close]} | {wait, boolean()} | wait].
-type start_nexus_opts() :: [{schedule_to_close_timeout, temporal_sdk:time()} | {awaitable_id, awaitable_id()} | {awaitable_event, [cmd | cancel_request | close]} | {wait, boolean()} | wait].
-type start_timer_opts() :: [{timer_id, atom() | unicode:chardata()} | {awaitable_id, awaitable_id()} | {awaitable_event, [cmd | cancel_request | close]} | {wait, boolean()} | wait].
Temporal external commands
-spec admit_signal(SignalOrSignalName :: signal() | unicode:chardata()) -> signal().
-spec admit_signal(SignalOrSignalName :: signal() | unicode:chardata(), Opts :: admit_signal_opts()) -> signal() | signal_data().
-spec respond_query(QueryOrQueryType :: query() | unicode:chardata(), Opts :: respond_query_opts()) -> query() | query_data().
Temporal external commands opts
-type respond_query_opts() :: [{result_type, temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.QueryResultType'()} | {answer, temporal_sdk:term_to_payloads()} | {error_message, unicode:chardata()} | {failure, temporal_sdk:application_failure() | temporal_sdk:user_application_failure()} | {awaitable_event, [request | response | close]} | {wait, boolean()} | wait].
Temporal marker commands
-spec record_env(Par :: atom(), Opts :: record_marker_opts()) -> marker() | marker_data() | no_return().
-spec record_rand_uniform(RangeOrOpts :: pos_integer() | record_marker_opts()) -> marker() | marker_data() | no_return().
-spec record_rand_uniform(Range :: pos_integer(), Opts :: record_marker_opts()) -> marker() | marker_data() | no_return().
-spec record_system_time(UnitOrOpts :: erlang:time_unit() | record_marker_opts()) -> marker() | marker_data() | no_return().
-spec record_system_time(Unit :: erlang:time_unit(), Opts :: record_marker_opts()) -> marker() | marker_data() | no_return().
-spec record_uuid4(Opts :: record_marker_opts()) -> marker() | marker_data() | no_return().
Workflow behaviour
-type context() :: #{cluster := temporal_sdk_cluster:cluster_name(), executor_pid := pid(), otel_ctx := otel_ctx:t(), execution_id := execution_id(), worker_opts := temporal_sdk_worker:opts(), history_table := ets:table(), index_table := ets:table(), workflow_info := context_workflow_info(), task := task(), attempt := pos_integer(), is_replaying := boolean()}.
-type context_workflow_info() :: #{workflow_execution := temporal_sdk_proto_service_workflow_binaries:'temporal.api.common.v1.WorkflowExecution'(), workflow_execution_task_queue := unicode:chardata(), workflow_type := unicode:chardata(), task_queue := unicode:chardata(), workflow_execution_timeout_msec := erlang:timeout(), workflow_run_timeout_msec := erlang:timeout(), workflow_task_timeout_msec := erlang:timeout(), last_completion_result => temporal_sdk:term_from_payloads(), attempt := pos_integer(), memo => temporal_sdk:term_from_mapstring_payload(), search_attributes => temporal_sdk:term_from_mapstring_payload(), header => temporal_sdk:term_from_mapstring_payload()}.
-callback execute(Context :: context(), Input :: temporal_sdk:term_from_payloads()) -> ExecutionResult :: execution_result().
-callback handle_failure(Class :: error | exit | throw, Reason :: term(), Stacktrace :: erlang:raise_stacktrace()) -> ignore | (ApplicationFailure :: temporal_sdk:application_failure() | temporal_sdk:user_application_failure()).
-callback handle_message(MessageName :: unicode:chardata(), MessageValue :: term()) -> {record, MarkerValue :: temporal_sdk:term_to_payloads()} | {fail, {Message :: temporal_sdk:serializable(), Source :: temporal_sdk:serializable(), Stacktrace :: temporal_sdk:serializable()}} | ignore.
-callback handle_query(HistoryEvents :: [temporal_sdk_workflow:history_event()], WorkflowQuery :: #{query_type := unicode:chardata(), query_args => temporal_sdk:term_from_payloads(), header => temporal_sdk:term_from_mapstring_payload()}) -> #{answer := temporal_sdk:term_to_payloads()} | #{error_message => unicode:chardata(), failure => temporal_sdk:application_failure() | temporal_sdk:user_application_failure(), cause => temporal_sdk_proto_service_workflow_binaries:'temporal.api.enums.v1.WorkflowTaskFailedCause'()}.