View Source Chorex.RuntimeState (Chorex v0.8.7)

Summary

Types

An entry in the inbox looks like a CIV token × message payload

t()

Functions

Throw away the top frame, assuming it's a recover frame. If it's not, raise an error.

Drop everything up to the first recover frame on the stack. Return the recovery token as well as the state with the stack popped.

Types

@type inbox_msg() :: {Chorex.Types.civ_tok(), msg :: any()}

An entry in the inbox looks like a CIV token × message payload

@type stack_frame() ::
  {:recv, civ_tok :: Chorex.Types.civ_tok(),
   match_fun :: (any() -> false | var_map()), cont_tok :: String.t(),
   vars :: var_map()}
  | {:return, cont_tok :: String.t(), vars :: var_map()}
@type t() :: %Chorex.RuntimeState{
  actor: term(),
  config: nil | %{required(atom()) => pid()},
  impl: atom(),
  inbox: :queue.queue(inbox_msg()),
  session_token: String.t(),
  stack: [stack_frame()],
  vars: var_map(),
  waiting_value: any()
}
@type var_map() :: %{} | %{required(atom()) => any()}

Functions

Link to this function

ditch_recover_frame(state)

View Source

Throw away the top frame, assuming it's a recover frame. If it's not, raise an error.

@spec drop_inbox(inbox_msg(), t()) :: t()
Link to this function

pop_to_recover_frame(state)

View Source
@spec pop_to_recover_frame(t()) :: {String.t(), t()}

Drop everything up to the first recover frame on the stack. Return the recovery token as well as the state with the stack popped.

Link to this function

push_barrier_frame(id, state)

View Source
Link to this function

push_continue_frame(cont_tok, state)

View Source
@spec push_continue_frame(String.t(), t()) :: t()
Link to this function

push_func_frame(cont_tok, state)

View Source
@spec push_func_frame(String.t(), t()) :: t()
@spec push_inbox(inbox_msg(), t()) :: t()
Link to this function

push_recover_frame(tok, state)

View Source
@spec push_recover_frame(String.t(), t()) :: t()
Link to this function

push_recv_frame(arg, state)

View Source
@spec push_recv_frame({Chorex.Types.civ_tok(), any(), String.t()}, t()) :: t()
Link to this function

put_var(state, name, val)

View Source
@spec put_var(t(), atom(), any()) :: t()