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

Tracks background query execution progress.

# `kind`

```elixir
@type kind() :: :query_execute | :query_udf
```

Background query task kind used when polling server job state.

# `t`

```elixir
@type t() :: %Aerospike.ExecuteTask{
  conn: GenServer.server(),
  kind: kind(),
  namespace: String.t(),
  node_name: String.t() | nil,
  set: String.t(),
  task_id: non_neg_integer()
}
```

Handle returned by background query execution helpers.

`node_name` is set when the background job was started on one node. When it
is `nil`, `status/1` and `wait/2` poll every active node in the cluster.

# `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`.

# `parse_status_response`

```elixir
@spec parse_status_response(String.t()) ::
  :complete | :in_progress | :not_found | {:error, Aerospike.Error.t()}
```

Parses a raw background query status response from the Aerospike info protocol.

Empty replies and server `ERROR:2` replies are treated as `:not_found`
because a background task can briefly be invisible before every target node
has observed it.

# `status`

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

Returns the current background query status across the target nodes.

# `wait`

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

Blocks until the background query 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 operation completes or returns an error.

---

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