# `Fleet.History`
[🔗](https://github.com/kuku/fleet/blob/main/lib/fleet/history.ex#L1)

Provides query access to the underlying rotating ring-buffer partition tables.

Allows searching, inspecting, and counting historical jobs retained within
the configured retention period (e.g. 7 days with `history_tables: 7, rotation_period: "1 day"`).

# `count_jobs`

```elixir
@spec count_jobs(Fleet.Client.repo_or_conn(), Fleet.Client.queue_name(), keyword()) ::
  {:ok, integer()} | {:error, term()}
```

Counts historical jobs in the queue's partition tables.

# `get_job`

```elixir
@spec get_job(Fleet.Client.repo_or_conn(), Fleet.Client.queue_name(), integer()) ::
  {:ok, map() | nil} | {:error, term()}
```

Fetches a single historical job by its event ID.

# `list_jobs`

```elixir
@spec list_jobs(Fleet.Client.repo_or_conn(), Fleet.Client.queue_name(), keyword()) ::
  {:ok, [map()]} | {:error, term()}
```

Lists historical jobs from the queue's partition tables.

## Options

  * `:limit` - Maximum number of jobs to return (default 50).
  * `:offset` - Pagination offset (default 0).
  * `:since` - Only include jobs created after this `DateTime`.
  * `:type` - Filter by worker/event type name.
  * `:order` - Sort order by id: `:desc` (default) or `:asc`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
