Request-scoped facts handed to every command, query, validator and policy.
Arc has no dependency injection container. Handlers call Repo, context modules and
Chronicle directly, and receive the caller's facts through this struct. The same values are
set as Logger metadata while the artifact runs (:arc_correlation_id, :arc_tenant).
:application- theArc.Applicationmodule running the artifact:principal- theArc.Principalof the caller:tenant- the resolved tenant, ornil:correlation_id/:causation_id- tracing identifiers (correlation is echoed on the response):metadata- free-form map; copied to the Chronicle append as causation properties:deadline- monotonic millisecond deadline, ornil:provided- values returned by the command'sprovide/2:allowed_severity- the highest non-blocking validation severity the caller accepts:chronicle- options passed to everyChronicle.append/3(for exampleclient:); for a named tenant it carries that tenant as the Chroniclenamespace::query- while a query runs, what the caller asked for:%{page:, page_size:, sort_by:, sort_direction:}(sort_byis thecamelCasewire name). A query that pages in the database reads it, for exampleArc.MongoDB.page/3
Summary
Functions
Whether the deadline, if any, has passed.
Builds a context, generating a correlation id when none is given.
Generates a canonical lowercase UUID v4 string.
Types
@type t() :: %Arc.Context{ allowed_severity: integer(), application: module() | nil, causation_id: String.t() | nil, chronicle: keyword(), correlation_id: String.t() | nil, deadline: integer() | nil, metadata: map(), principal: Arc.Principal.t(), provided: map(), query: map(), tenant: String.t() | nil }
Functions
Whether the deadline, if any, has passed.
Builds a context, generating a correlation id when none is given.
@spec new_correlation_id() :: String.t()
Generates a canonical lowercase UUID v4 string.