# `Macaw.Live.Manager.Reader`
[🔗](https://github.com/dcoai/macaw_live/blob/v0.1.0/lib/macaw/live/manager/reader.ex#L1)

A source manager's window read through a visitor's overlay (spec/03 §2, macaw spec/13
§3.4). The managers and their table reads are macaw_data's (`Macaw.Data.Manager`,
`Macaw.Data.Manager.Reader`, macaw_data spec/01 §6.4, #137); this read stays here, since
it overlays with macaw (`Macaw.Overlay.read/4`), which macaw_data never calls.

# `overlay`

```elixir
@type overlay() :: %{
  overlay: Macaw.Overlay.t(),
  filters: map(),
  description: Macaw.Data.Source.Description.t()
}
```

A visitor's overlay of the source a reader reads (macaw spec/13 §3.4): the overlay, the
host's policy's `filters:` and the description the reader's slot reads the source by.

# `read`

```elixir
@spec read(
  atom(),
  Macaw.Data.Manager.key(),
  Macaw.Data.Source.Request.t(),
  overlay() | nil
) ::
  {Macaw.Data.Manager.status() | {:invalid, list()},
   Macaw.Data.Delivery.t() | nil}
```

The window `request` asks of the manager of `key` under the supervisor `live`, read
through a visitor's `overlay`: as `Macaw.Data.Manager.Reader.read/3` reads it with `nil`,
else the visitor's view of it, packed and columnar.

  * **Asked for as many more rows as the visitor removed,** so a budget the window is
    cut to still holds as many once they are retracted; the window read is the one
    every reader asking it shares (`Macaw.Data.Manager.Finished`), the overlay applied
    over it in the caller's process alone, since it is this visitor's.
  * **Overlaid by macaw** (`Macaw.Overlay.read/4`): each removed row retracted by its
    identity's bytes in the column's buffers, never decoding the source's rows, and each
    added row the request's params select appended as a chunk of its own.
  * **Finished again as one:** the overlaid delivery is finished for the request by the
    slot's description honoring nothing but its params, so the window, the order and
    the budget apply to the visitor's rows and the source's alike, as `fetch/2` finishes
    it (macaw spec/06 §3.5).

A window not held is `{status, nil}`; a table the overlay can't take, a delivery that
didn't pack, or a finish that refuses it is `{{:invalid, faults}, nil}`, the reader drawn
`invalid`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
