Defdo.DDNS.RecordStore behaviour (defdo_ddns v0.5.0)

Copy Markdown

Behaviour and runtime facade for DDNS record persistence.

The configured backend is responsible for storing generic DDNS record definitions and exposing them to the rest of the application.

Summary

Functions

Returns the configured backend module.

Returns the backend child spec tuple for the supervisor.

Returns the current snapshot from the configured backend.

Returns the current records from the configured backend.

Persists the configured backend snapshot to disk if supported.

Returns the current records from the configured backend.

Reloads the configured backend from its current bootstrap sources.

Replaces the configured backend records with a new list.

Returns the current snapshot from the configured backend.

Returns the backend start options.

Returns safe runtime diagnostics from the configured backend.

Writes the current backend snapshot to an explicit path.

Types

record()

@type record() :: %{required(String.t()) => any()}

Callbacks

export_snapshot(keyword)

@callback export_snapshot(keyword()) :: map()

list_records(keyword)

@callback list_records(keyword()) :: [record()]

persist(keyword)

@callback persist(keyword()) :: :ok | {:error, term()}

reload(keyword)

@callback reload(keyword()) :: :ok | {:error, term()}

replace_records(list)

@callback replace_records([record()]) :: :ok | {:error, term()}

start_link(keyword)

@callback start_link(keyword()) :: GenServer.on_start()

status(keyword)

@callback status(keyword()) :: map() | {:error, term()}

write_snapshot(t, keyword)

@callback write_snapshot(
  String.t(),
  keyword()
) :: :ok | {:error, term()}

Functions

backend_module()

@spec backend_module() :: module()

Returns the configured backend module.

child_spec()

@spec child_spec() :: {module(), keyword()}

Returns the backend child spec tuple for the supervisor.

diagnostics(opts \\ [])

@spec diagnostics(keyword()) :: map() | {:error, term()}

Alias for status/1.

export_snapshot(opts \\ [])

@spec export_snapshot(keyword()) :: map()

Returns the current snapshot from the configured backend.

list_records(opts \\ [])

@spec list_records(keyword()) :: [record()]

Returns the current records from the configured backend.

persist(opts \\ [])

@spec persist(keyword()) :: :ok | {:error, term()}

Persists the configured backend snapshot to disk if supported.

records()

@spec records() :: [record()]

Returns the current records from the configured backend.

reload(opts \\ [])

@spec reload(keyword()) :: :ok | {:error, term()}

Reloads the configured backend from its current bootstrap sources.

replace_records(records)

@spec replace_records([record()]) :: :ok | {:error, term()}

Replaces the configured backend records with a new list.

snapshot()

@spec snapshot() :: map()

Returns the current snapshot from the configured backend.

start_options()

@spec start_options() :: keyword()

Returns the backend start options.

These include the generic record-store flags plus any adapter-specific options configured under :options.

status(opts \\ [])

@spec status(keyword()) :: map() | {:error, term()}

Returns safe runtime diagnostics from the configured backend.

write_snapshot(path, opts \\ [])

@spec write_snapshot(
  String.t(),
  keyword()
) :: :ok | {:error, term()}

Writes the current backend snapshot to an explicit path.