Running the layers' steps (spec/04 §7.3, spec/05 §5.2): each layer's steps are one list,
data and spatial steps in any order, validated together by
Macaw.Data.Operations.validate/3 against the Frame's operations registry with the
frame's context, and run in order through Macaw.Data.Operations: a column-native step
through the held Macaw.Data.Operations.Cache, so a delivery of a chunked table re-runs
only the chunks that changed, any other by its run/3.
A plain value the Frame holds (t/0), passed back each time, with no process,
ETS or clock. new/1 makes one from the registry; run/3 runs every layer and answers
each layer's table, or its faults, with the value to hold next:
pipeline = Pipeline.new(registry)
{[{:ok, table}], pipeline} = Pipeline.run(pipeline, [%{steps: steps, table: slot}], context)The context is the model's context/1 (spec/03): frame: %{width, height, center},
projection and prepared where the model has them, with now, schema and sources
as the Frame gives them. A layer's own context: (its slot's schema) is merged over it.
- Once per delivery. A step's result is held under its key: the key of what it
reads (its input table's chunks by version, or the step before it), the step's
identity (
Macaw.Data.Operations.step_digest/2of the checked node, a frame-bound"plot"already the width), and the parts of the context the step reads: itsneeds/0(frame,projection) and the keys itsreads/0names (now,schema,scale,level,sources). So a second run over one delivery runs no step, a resize re-runs only the steps that read the frame and what follows them, and a render never runs one:nowis the context's, never a clock read. - Shared prefixes. Two layers whose step lists are identical up to some step have
one key up to it, so the prefix runs once: two layers over
stack(fields)of one slot run the stack once. - Prepared once. A step with
prepare/3(theforcelayout) is prepared once per graph, under itskey/1where it has one (the node withoutoutput), so every layer reading one graph reads one layout, and the next delivery's preparation is given the last aswarm. - Faults are values. A step's fault stops its own layer, answered as
{:error, faults}at[:layers, i, :data, :steps, j | key]; every other layer's table is answered.
last/1 says what the last run did: the steps it ran and the steps it reused.
Summary
Types
A layer's answer: its table after every step, or its faults at its path.
A layer's steps and the table of its slot, with its own context.
The value the Frame holds from delivery to delivery.
Functions
The pipeline with every layer's steps checked in context and held (spec/05 §5.2): what
run/3 would check first, done once when the value is made, so a delivery under the
same context runs no check. Each layer is %{steps, context}; a table is not read.
What the last run/3 did: %{ran: steps run, reused: steps whose result was held}.
A pipeline over the operations registry (Macaw.Frame.Layers.operations/1).
Every layer's steps run over its table with context (spec/04 §7.3): {answers, pipeline}, one answer per layer in order, and the value to hold for the next run, which
keeps only what this run read.
Whether a prepared layout of the last run is still settling (spec/01 §3.6): a force
simulation Macaw.Draw.Layout.Force.running?/1 holds for.
One step of every running layout (spec/01 §3.6): each prepared simulation that is still
running?/1 steps once, held as the preparation of its graph, and every step result is
let go so the next run/3 draws from the stepped positions; a settled simulation and
every chunk part of the cache are kept. A pipeline with nothing running answers itself.
Types
@type answer() :: {:ok, Macaw.Data.Table.t()} | {:error, [{list(), term()}, ...]}
A layer's answer: its table after every step, or its faults at its path.
@type layer() :: %{ :steps => [map()], :table => Macaw.Data.Table.t(), optional(:context) => map() }
A layer's steps and the table of its slot, with its own context.
@type t() :: %Macaw.Frame.Pipeline{ cache: Macaw.Data.Operations.Cache.t(), checked: %{required(term()) => {:ok, [map()]} | {:error, list()}}, last: %{ran: non_neg_integer(), reused: non_neg_integer()}, memo: %{ required(term()) => {:ok, Macaw.Data.Table.t()} | {:error, {term(), term()}} }, prepared: %{required(term()) => term()}, registry: Macaw.Data.Operations.Registry.t() }
The value the Frame holds from delivery to delivery.
Functions
The pipeline with every layer's steps checked in context and held (spec/05 §5.2): what
run/3 would check first, done once when the value is made, so a delivery under the
same context runs no check. Each layer is %{steps, context}; a table is not read.
@spec last(t()) :: %{ran: non_neg_integer(), reused: non_neg_integer()}
What the last run/3 did: %{ran: steps run, reused: steps whose result was held}.
@spec new(Macaw.Data.Operations.Registry.t()) :: t() | {:error, [{list(), term()}, ...]}
A pipeline over the operations registry (Macaw.Frame.Layers.operations/1).
Every layer's steps run over its table with context (spec/04 §7.3): {answers, pipeline}, one answer per layer in order, and the value to hold for the next run, which
keeps only what this run read.
Whether a prepared layout of the last run is still settling (spec/01 §3.6): a force
simulation Macaw.Draw.Layout.Force.running?/1 holds for.
One step of every running layout (spec/01 §3.6): each prepared simulation that is still
running?/1 steps once, held as the preparation of its graph, and every step result is
let go so the next run/3 draws from the stepped positions; a settled simulation and
every chunk part of the cache are kept. A pipeline with nothing running answers itself.