Spectre.Flow.Constraint (Spectre v0.3.0)

Copy Markdown View Source

Namespaced constraint contributed to a compiled flow by an extension.

Source constraints participate in routing. Other kinds remain attached to the selected rule so inference or workflow extensions can consume them without affecting route visibility.

Summary

Functions

Filters incompatible rules and prefers constrained rules inside the existing global-interrupt and ordinary-rule precedence groups.

Returns whether a rule's source constraints accept an input.

Types

t()

@type t() :: %Spectre.Flow.Constraint{
  kind: :source | :inference | atom(),
  metadata: map(),
  mode: :any | :all,
  namespace: atom() | String.t(),
  values: [term()]
}

Functions

filter_and_order(rules, input)

@spec filter_and_order([Spectre.Rule.t()], Spectre.Input.t()) :: [Spectre.Rule.t()]

Filters incompatible rules and prefers constrained rules inside the existing global-interrupt and ordinary-rule precedence groups.

match?(constraints, input)

@spec match?([t()], Spectre.Input.t()) :: boolean()

Returns whether a rule's source constraints accept an input.

new(constraint)

@spec new(t() | map() | keyword()) :: t()