ExDav.Storage.Memory (ExDav v0.1.0)

Copy Markdown View Source

In-memory implementation of ExDav.Storage. Backed by a single Agent registered under the module name, for use in dev demos and tests.

Add ExDav.Storage.Memory to your supervision tree (it has no init args), or call start_link/1 from a test setup. Use reset/0 between tests to clear state.

children = [ExDav.Storage.Memory]
Supervisor.start_link(children, strategy: :one_for_one)

ExDav.Storage.Memory.upsert_user("alice", "secret")
{:ok, _} = ExDav.Storage.Memory.create_calendar("alice", "default", displayname: "Default")

Plug wiring:

plug ExDav.CalDav.Plug,
  storage: ExDav.Storage.Memory,
  authenticator: {ExDav.Authenticator.Basic,
                  verify: {ExDav.Storage.Memory, :authenticate}}

Summary

Functions

Returns a specification to start this module under a supervisor.

Reset all state. Intended for tests.

Functions

authenticate(username, password)

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

reset()

Reset all state. Intended for tests.

start_link(opts \\ [])

upsert_user(username, password, opts \\ [])