Macaw.Live.Assets.Store.Memory (macaw_live v0.1.0)

Copy Markdown View Source

The default asset store (spec/06 §2.1): an ETS table its process owns, started under the host's Macaw.Live.Supervisor as <live>.Assets, so the table is the supervisor's and never an application's. Copied from visualize's Visualize.Sheets (D-297), its table now named by the supervisor and its bound an argument.

It holds at most limit: entries (4,096 by default), stylesheets and proxy routes together; past that the oldest registered is dropped, and the next mount that declares it registers it again. Reads go to the table directly, writes through the process. A sheet is per node with this store: a node that hasn't registered one answers 404 for it until one of its pages renders it.

Summary

Functions

Its child spec: name: (required, the table's name too) and limit:.

Starts the store: name:, an atom, required; limit:, a positive integer, 4,096 unless given. {:ok, pid}, or {:error, faults}: {[:name], :required}, {[:limit], {:type, :pos_integer}}.

Functions

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Its child spec: name: (required, the table's name too) and limit:.

start_link(opts)

@spec start_link(keyword()) ::
  GenServer.on_start() | {:error, [Macaw.Base.Fault.t(), ...]}

Starts the store: name:, an atom, required; limit:, a positive integer, 4,096 unless given. {:ok, pid}, or {:error, faults}: {[:name], :required}, {[:limit], {:type, :pos_integer}}.