Macaw.Layers.Store.Memory (macaw_layers v0.5.0)

Copy Markdown View Source

The default store, held in memory (spec/03 §1.2): an Agent the host starts under its own supervisor, its context the agent.

children = [{Macaw.Layers.Store.Memory, types: [MyApp.Layout], name: MyApp.Library}]
Macaw.Layers.Store.put({Macaw.Layers.Store.Memory, MyApp.Library}, entry)

Ids are issued from one sequence per kind that never repeats, a deleted id never reissued, so a stale id cannot resolve to something new and ids sort by creation. Its import is Macaw.Layers.Store.relocate/3, applied to a copy of its state and swapped in whole, so a failed import leaves nothing behind.

Summary

Functions

Returns a specification to start this module under a supervisor.

The store, started: types: the fragment types it holds (required; default closed, a type not listed is not storable), check: the host's check over each imported entry, name: as Agent takes it. Types that Macaw.Layers.Store.check_types/1 refuses, or none given, start nothing: {:error, faults}, each under [:types].

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

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

The store, started: types: the fragment types it holds (required; default closed, a type not listed is not storable), check: the host's check over each imported entry, name: as Agent takes it. Types that Macaw.Layers.Store.check_types/1 refuses, or none given, start nothing: {:error, faults}, each under [:types].