# `Jido.Messaging.SessionManager.Partition`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/session_manager/partition.ex#L1)

Partition process for session route state.

Each partition owns an ETS table with TTL and capacity pruning so session
lookups can resolve exact routes, room-scoped fallbacks, or supplied fallback
routes without centralizing all traffic in one process.

# `state`

```elixir
@type state() :: %{
  instance_module: module(),
  partition: non_neg_integer(),
  table: :ets.tid(),
  ttl_ms: pos_integer(),
  max_entries_per_partition: pos_integer(),
  prune_interval_ms: pos_integer(),
  order: :queue.queue(),
  next_seq: non_neg_integer()
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get`

```elixir
@spec get(
  module(),
  non_neg_integer(),
  Jido.Messaging.SessionManager.session_key(),
  timeout()
) ::
  {:ok, Jido.Messaging.SessionManager.route_record()}
  | {:error, :not_found | :expired | :partition_unavailable}
```

Fetches a stored route record for a session key.

# `prune`

```elixir
@spec prune(module(), non_neg_integer(), timeout()) ::
  {:ok, %{pruned: non_neg_integer()}} | {:error, :partition_unavailable}
```

Removes expired entries from a partition immediately.

# `resolve`

```elixir
@spec resolve(
  module(),
  non_neg_integer(),
  Jido.Messaging.SessionManager.session_key(),
  [Jido.Messaging.SessionManager.route()],
  timeout()
) ::
  {:ok, Jido.Messaging.SessionManager.resolution()}
  | {:error, :no_route | :partition_unavailable}
```

Resolves a session route from exact, room-scoped, or provided fallback routes.

# `set`

```elixir
@spec set(
  module(),
  non_neg_integer(),
  Jido.Messaging.SessionManager.session_key(),
  Jido.Messaging.SessionManager.route(),
  keyword(),
  timeout()
) :: :ok | {:error, :partition_unavailable}
```

Stores a route for a session key in the selected partition.

# `start_link`

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

Starts a session manager partition process.

# `whereis`

```elixir
@spec whereis(module(), non_neg_integer()) :: pid() | nil
```

Returns the registered process for a partition, if it is running.

---

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