Visualize.Board.Cell (Visualize v0.8.3)

Copy Markdown View Source

One cell of a live board, as a process (spec/15 §8.3, D-146).

A cell process applies, compiles and draws its component, and sends what it shows — a Visualize.Board.View — straight to the board's subscribers, so no frame crosses the board's mailbox. The board (Visualize.Board.Server) starts one per cell, :temporary under a supervisor of its own, monitors it and restarts it with a backoff: a cell that dies is shown crashed and started again, alone.

  • The heap limit. The cell's first act is Process.flag(:max_heap_size, …) with kill: true, so a design that grows its heap without bound — a 10,000-tick axis, an unbounded layout, a slot fed millions of rows — is killed in its own process.
  • Coalescing. A data message taken from the mailbox first takes every later one behind it and keeps the newest, so a cell that falls behind skips to the present and a slow cell drops only its own frames.
  • Drawing. With every slot holding a delivery, the rows are placed by their timestamp with a break in every gap (Visualize.Board.Rows), the component is applied at the cell's box and compiled, one compiled chart per frame, and every data change is a Visualize.Chart.Compiled.step/3 per frame inside one accessible root. A delivery naming another schema version (Compiled.stale?/2), a new size and a new chart or variables compile again, carry/2'd from the compiled chart before. The deliveries are first read as a compiled chart's tick reads its sources (spec/14 §12.5): a tensor and tuple rows named by the slot's fields, and a delivery its slot cannot read a fault — the cell keeps the frame it holds and is {:invalid, errors} until one that reads arrives (D-232).

The board's messages are plain sends, never calls, so a slow cell never holds the board: {:data, slots, now}, {:now, now}, {:size, size}, {:component, chart, vars}, {:selection, selection} and {:subscribers, pids, newcomer}.

  • The selection (spec/15 §13.2, D-151, D-171). A cell whose rows hold the board's selection draws its data in the palette's view states: its rows gain a :"$vis_state" column, :selected where the selection is and :muted elsewhere, and each mark with data lays {:field, :"$vis_state"} in its style stack, the style the column names (#644), before a trailing local edit (spec/14 §3.7). A cell that does not hold it draws as before.
  • A pick, {:pick, from, ref, series, index}, is answered to from as {ref, reply}: the row behind that keyboard point, its identity, item and frame, or :error.
  • A click, {:event, from, ref, click}, is answered the same way (spec/15 §9.2, D-170): the Visualize.Event of a click on the drawing the cell holds, its row read from the rows each mark drew at the last frame, or :error. Each frame drawn has a token of its own, the view's drawn, and a click carrying another is dropped.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.