Aerospike.Scan (Aerospike Driver v0.3.1)

Copy Markdown View Source

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.

Summary

Types

Bin names accepted by select/2.

t()

Scan description consumed by Aerospike.scan_* helpers.

Functions

Appends a server-side expression filter.

Sets the maximum number of records to return.

Starts a namespace-wide scan.

Starts a scan limited to one set.

When true, the server omits bin payloads.

Attaches a partition filter for partial scans or advanced resume.

Sets the records-per-second throttle.

Restricts returned bin names.

Types

bin_names()

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

Bin names accepted by select/2.

t()

@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.

Functions

filter(scan, filter)

@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(scan, n)

@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(namespace)

@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(namespace, set)

@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(scan, flag)

@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(scan, partition_filter)

@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(scan, n)

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

Sets the records-per-second throttle.

0 disables scan-level throttling.

select(scan, bin_names)

@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.