View Source Antikythera.Context (antikythera v0.5.1)
Definition of Antikythera.Context
struct which represents a context for an execution of gear code.
Note that gear_entry_point
is basically of type {module, atom}
, it is nil
during
(1) executor_pool_web_request/1
and (2) no_route/1
error handler.
Summary
Functions
Type-aware getter for context_id.
Type-aware setter for context_id.
Type-aware getter for executor_pool_id.
Type-aware setter for executor_pool_id.
Type-aware getter for gear_entry_point.
Type-aware setter for gear_entry_point.
Type-aware getter for gear_name.
Type-aware setter for gear_name.
Creates a new instance of Antikythera.Context by using the given dict
.
A variant of new/1
which returns t
or raise if validation fails.
Type-aware getter for start_time.
Type-aware setter for start_time.
Updates an existing instance of Antikythera.Context with the given dict
.
The values in the dict
are validated by each field's valid?/1
function.
Returns {:ok, valid_struct}
or {:error, reason}
.
A variant of update/2
which returns t
or raise if validation fails.
In other words, update/2
followed by Croma.Result.get!/1
.
Checks if the given value belongs to t/0
or not.
Types
@type t() :: %Antikythera.Context{ context_id: Antikythera.ContextId.t(), executor_pool_id: Croma.TypeGen.Nilable.Antikythera.ExecutorPool.Id.t(), gear_entry_point: Croma.TypeGen.Nilable.Antikythera.Context.GearEntryPoint.t(), gear_name: Antikythera.GearName.t(), start_time: Antikythera.Time.t() }
Functions
@spec context_id(t()) :: Antikythera.ContextId.t()
Type-aware getter for context_id.
@spec context_id(t(), Antikythera.ContextId.t()) :: t()
Type-aware setter for context_id.
@spec executor_pool_id(t()) :: Croma.TypeGen.Nilable.Antikythera.ExecutorPool.Id.t()
Type-aware getter for executor_pool_id.
Type-aware setter for executor_pool_id.
@spec gear_entry_point(t()) :: Croma.TypeGen.Nilable.Antikythera.Context.GearEntryPoint.t()
Type-aware getter for gear_entry_point.
Type-aware setter for gear_entry_point.
@spec gear_name(t()) :: Antikythera.GearName.t()
Type-aware getter for gear_name.
@spec gear_name(t(), Antikythera.GearName.t()) :: t()
Type-aware setter for gear_name.
@spec new(term()) :: Croma.Result.t(t())
Creates a new instance of Antikythera.Context by using the given dict
.
Returns {:ok, valid_struct}
or {:error, reason}
.
The values in the dict
are validated by each field's valid?/1
function.
If the value was invalid, it will be passed to new/1
of the field
For missing fields, followings will be tried:
default/0
of each field typenew/1
of each field type, with empty map as input
A variant of new/1
which returns t
or raise if validation fails.
In other words, new/1
followed by Croma.Result.get!/1
.
@spec start_time(t()) :: Antikythera.Time.t()
Type-aware getter for start_time.
@spec start_time(t(), Antikythera.Time.t()) :: t()
Type-aware setter for start_time.
@spec update(t(), Dict.t()) :: Croma.Result.t(t())
Updates an existing instance of Antikythera.Context with the given dict
.
The values in the dict
are validated by each field's valid?/1
function.
Returns {:ok, valid_struct}
or {:error, reason}
.
A variant of update/2
which returns t
or raise if validation fails.
In other words, update/2
followed by Croma.Result.get!/1
.
Checks if the given value belongs to t/0
or not.