View Source Chord.Cleanup.Server (Chord v0.1.4)

Periodic cleanup server for stale contexts and deltas.

This server periodically triggers the cleanup logic defined in Chord.Cleanup, removing stale entries from the backend.

State

The server's state includes:

  • :interval - The interval (in milliseconds) between cleanup executions.
  • :backend_opts - A keyword list of options passed to backend listing functions.

Example

Chord.Cleanup.Server.start_link(interval: :timer.minutes(30), backend_opts: [limit: 100])

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the cleanup server with the specified options.

Updates the backend options for periodic cleanup at runtime.

Updates the interval for periodic cleanup at runtime.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

Starts the cleanup server with the specified options.

Options

  • :interval (integer): Time interval in milliseconds for periodic cleanup (default: 1 hour).
  • :backend_opts (Keyword.t): Options passed to backend listing functions (see "Common Options" in the Chord module).

Example

iex> Chord.Cleanup.Server.start_link(interval: :timer.minutes(30), backend_opts: [limit: 50])
{:ok, pid}

update_backend_opts(new_opts, name \\ __MODULE__)

Updates the backend options for periodic cleanup at runtime.

Parameters

  • new_opts (Keyword.t): The new backend options.
  • name (atom): The name of the GenServer instance. Defaults to __MODULE__.

Returns

  • :ok if the backend options were successfully updated.

update_interval(new_interval, name \\ __MODULE__)

Updates the interval for periodic cleanup at runtime.

Parameters

  • new_interval (integer): The new interval in milliseconds.
  • name (atom): The name of the GenServer instance. Defaults to __MODULE__.

Returns

  • :ok if the interval was successfully updated.