# `Macaw.Live.Assets.Store`
[🔗](https://github.com/dcoai/macaw_live/blob/v0.1.0/lib/macaw/live/assets/store.ex#L1)

Where the runtime keeps what it registers at mount (spec/06 §2.1): generated stylesheets
and proxy routes, a behavior over an argument, so a host of several nodes plugs a shared
store. Copied from visualize's `Visualize.Sheets` table and made a behavior.

A host chooses it with the supervisor's `assets:` option, `{module, arg}`;
`Macaw.Live.Assets.Store.Memory`, the default, is an ETS table the supervisor owns,
bounded at 4,096 entries. A store module exporting `child_spec/1` is started under the
supervisor with its argument and `name: <live>.Assets`, and that argument, the name in
it, is the one its callbacks are given.

Keys are the runtime's: `{:stylesheet, hex}` for a sheet, `hex` the SHA-256 of its bytes,
and `{:route, component, name, digest}` for a proxy route. A key's value never changes,
since each is named by its content, so putting a key already held is a no-op.

# `fetch`

```elixir
@callback fetch(arg :: term(), key :: term()) :: {:ok, term()} | :error
```

The value held under `key`: `{:ok, value}`, or `:error` for one it doesn't hold.

# `put`

```elixir
@callback put(arg :: term(), key :: term(), value :: term()) :: :ok | {:error, term()}
```

Holds `value` under `key`: `:ok`, or `{:error, reason}` for a store that couldn't.

---

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