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

Composable scan description.

The scan itself is pure data. It does not own transport state or
partition iteration.

Scan execution lives in explicit facade calls such as
`Aerospike.scan_stream/3`, `Aerospike.scan_all/3`, and
`Aerospike.scan_count/3`. Node-targeted execution uses `node: node_name`
in facade opts where supported; discover valid names with
`Aerospike.node_names/1` or `Aerospike.nodes/1`.

Filters are server-side expressions. Append expressions with
`filter/2` to keep returned records scoped by
`%Aerospike.Exp{}` evaluation.

# `bin_names`

```elixir
@type bin_names() :: [String.t()]
```

Bin names accepted by `select/2`.

# `t`

```elixir
@type t() :: %Aerospike.Scan{
  bin_names: bin_names(),
  filters: [Aerospike.Exp.t()],
  max_records: pos_integer() | nil,
  namespace: String.t(),
  no_bins: boolean(),
  partition_filter: Aerospike.PartitionFilter.t() | nil,
  records_per_second: non_neg_integer(),
  set: String.t() | nil
}
```

Scan description consumed by `Aerospike.scan_*` helpers.

`filters` are server-side filter expressions combined with boolean AND by
the encoder.

# `filter`

```elixir
@spec filter(t(), Aerospike.Exp.t()) :: t()
```

Appends a server-side expression filter.

The scan encoder appends a single `FILTER_EXP` field for the expression
filter set.

# `max_records`

```elixir
@spec max_records(t(), pos_integer()) :: t()
```

Sets the maximum number of records to return.

Pagination helpers require `max_records` on the scan struct; the returned
page may contain fewer records when partition progress completes first.

# `new`

```elixir
@spec new(String.t()) :: t()
```

Starts a namespace-wide scan.

The namespace must be a non-empty string. Use `new/2` to restrict the scan
to a set.

# `new`

```elixir
@spec new(String.t(), String.t()) :: t()
```

Starts a scan limited to one set.

Both namespace and set must be non-empty strings.

# `no_bins`

```elixir
@spec no_bins(t(), boolean()) :: t()
```

When `true`, the server omits bin payloads.

This is useful for count-like scans or key/header-only workflows.

# `partition_filter`

```elixir
@spec partition_filter(t(), Aerospike.PartitionFilter.t()) :: t()
```

Attaches a partition filter for partial scans or advanced resume.

The filter is usually built with `Aerospike.PartitionFilter.all/0`,
`by_id/1`, `by_range/2`, or restored from a page cursor.

# `records_per_second`

```elixir
@spec records_per_second(t(), non_neg_integer()) :: t()
```

Sets the records-per-second throttle.

`0` disables scan-level throttling.

# `select`

```elixir
@spec select(t(), bin_names()) :: t()
```

Restricts returned bin names.

Passing an empty list keeps the server default of returning all bins unless
`no_bins/2` or execution opts request otherwise.

---

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