Stevedore.Store.Memory (Stevedore v0.1.0)

Copy Markdown View Source

An in-memory Stevedore.Store backed by an Agent.

Intended for tests and ephemeral use. The store config is the agent pid returned by start_link/1; the caller owns the process lifecycle (use start_supervised!/1 in tests). Has no stable on-disk path, so local_path/2 returns :unsupported.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the store. The returned pid is the config passed to the other callbacks.

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()

Starts the store. The returned pid is the config passed to the other callbacks.

Examples

iex> {:ok, store} = Stevedore.Store.Memory.start_link([])
iex> d = Stevedore.Digest.compute("blob")
iex> Stevedore.Store.Memory.put(store, d, "blob")
:ok
iex> Stevedore.Store.Memory.get(store, d)
{:ok, "blob"}