ExDatalog.Constraint.Context (ExDatalog v0.2.0)

Copy Markdown View Source

Evaluation context passed to constraint implementations.

The context carries metadata about the current evaluation environment, including backend capabilities and provenance tracking settings.

Threading

The Constraint.Context is constructed by Engine.Naive from the storage backend's capabilities and passed through EvaluatorConstraintEvalConstraint.evaluate/3. Constraint implementations receive it as the third argument, enabling them to inspect storage capabilities if needed (e.g., a future Z3 backend checking external_execution).

For v0.2.0, no constraint implementation reads from the context, but the plumbing is complete and the context carries real backend capabilities.

Summary

Functions

Creates a new context with default capabilities.

Creates a new context with the given capabilities.

Creates a new context with the given capabilities and provenance flag.

Types

t()

@type t() :: %ExDatalog.Constraint.Context{
  capabilities: ExDatalog.Capabilities.t(),
  provenance: boolean()
}

Functions

new()

@spec new() :: t()

Creates a new context with default capabilities.

Examples

iex> ctx = ExDatalog.Constraint.Context.new()
iex> ctx.capabilities.storage_type
:map
iex> ctx.provenance
false

new(capabilities)

@spec new(ExDatalog.Capabilities.t()) :: t()

Creates a new context with the given capabilities.

Examples

iex> caps = %ExDatalog.Capabilities{storage_type: :ets, indexed_lookup: true}
iex> ctx = ExDatalog.Constraint.Context.new(caps)
iex> ctx.capabilities.storage_type
:ets
iex> ctx.provenance
false

new(capabilities, provenance)

@spec new(ExDatalog.Capabilities.t(), boolean()) :: t()

Creates a new context with the given capabilities and provenance flag.

Examples

iex> caps = %ExDatalog.Capabilities{storage_type: :ets}
iex> ctx = ExDatalog.Constraint.Context.new(caps, true)
iex> ctx.provenance
true