# `Aerospike.IndexTask`
[🔗](https://github.com/luisgabrielroldan/aerospike_driver/blob/v0.3.1/lib/aerospike/index_task.ex#L1)

Tracks secondary-index build progress.

# `t`

```elixir
@type t() :: %Aerospike.IndexTask{
  conn: GenServer.server(),
  index_name: String.t(),
  namespace: String.t()
}
```

Handle returned while a secondary index is being built.

Use `status/1` for one poll or `wait/2` to block until the index is visible.
`wait/2` accepts `:poll_interval` and `:timeout` in milliseconds.

# `wait_opt`

```elixir
@type wait_opt() ::
  {:poll_interval, non_neg_integer()} | {:timeout, non_neg_integer()}
```

Option accepted by `wait/2`.

# `wait_opts`

```elixir
@type wait_opts() :: [wait_opt()]
```

Keyword options accepted by `wait/2`.

# `status`

```elixir
@spec status(t()) :: {:ok, :complete | :in_progress} | {:error, Aerospike.Error.t()}
```

Returns the current secondary-index build status.

# `wait`

```elixir
@spec wait(struct(), keyword()) :: :ok | {:error, Aerospike.Error.t()}
@spec wait(t(), wait_opts()) :: :ok | {:error, Aerospike.Error.t()}
```

Blocks until the secondary-index build completes or the timeout is exceeded.

Supported options:

  * `:poll_interval` — milliseconds to sleep between status checks.
    Defaults to `1_000`.
  * `:timeout` — maximum milliseconds to wait. When omitted, polling
    continues until the index is complete or returns an error.

---

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