Snodo.Extensions.Tasks.Store.Memory (snodo_tasks v0.3.2)

Copy Markdown View Source

In-memory revisioned Tasks store intended for examples and tests.

The required :scope option derives an authorization scope from each request context (see Snodo.Extensions.Tasks.Store.scope_option/2). Scope mismatches deliberately return :not_found, so task existence is not disclosed across callers.

This adapter implements the complete durable-store contract, including descriptors, fenced renewable claims, store-clock retry eligibility, recovery scans, and creation-based TTL reaping. Its records themselves remain volatile.

create/4 refuses a task with {:error, {:capacity_exceeded, limit}} when the store already holds :max_tasks tasks (default 10,000) or the caller's scope already has :max_active_tasks_per_scope working or input-required tasks (default 100). Either may be :infinity. Both counts come from the stored tasks, and an expired task counts until it is reaped.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

history_entry()

@type history_entry() :: %{
  event: Snodo.Extensions.Tasks.Event.t(),
  committed_at: String.t(),
  revision: pos_integer()
}

server()

@type server() :: GenServer.server()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

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