Aerospike.Op.HLL (Aerospike Driver v0.3.1)

Copy Markdown View Source

HyperLogLog operations for Aerospike.operate/4.

HyperLogLog bins require Aerospike server 4.9 or later. The server does not support HyperLogLog bins nested inside lists or maps, so these operations do not accept ctx:.

init/4 and add/5 default both bit counts to -1, which asks the server to choose its defaults. When set explicitly, index bits are typically 4 to 16, min-hash bits 4 to 58, and their sum must not exceed 64.

Multi-HLL read operations accept hlls as a list of {:bytes, blob} HLL values. Modify operations accept mnemonic flags: values for the server write policy.

Summary

Types

HyperLogLog write flags.

Options accepted by multi-HLL read helpers.

t()

Opaque HyperLogLog operation for Aerospike.operate/4.

Options accepted by HyperLogLog modify operations.

Functions

Returns [index_bit_count, min_hash_bit_count] for the HyperLogLog bin.

Folds the HyperLogLog bin to a smaller index bit count.

Returns the estimated cardinality of the HyperLogLog bin.

Returns the estimated cardinality of the intersection of the bin and hlls.

Returns an estimated similarity score for the bin and hlls.

Returns a HyperLogLog blob containing the union of the bin and hlls.

Returns the estimated cardinality of the union of the bin and hlls.

Creates a new HyperLogLog bin or resets an existing one.

Refreshes stale cached cardinality and returns the estimated count.

Merges every HyperLogLog value in hlls into the bin.

Allow folding to less precise HyperLogLog settings when needed.

Only create the HyperLogLog bin when it does not already exist.

Use default HyperLogLog write behavior.

Do not fail the command when a HyperLogLog operation is denied by write flags.

Only update the HyperLogLog bin when it already exists.

Types

flags()

@type flags() :: atom() | [atom()] | non_neg_integer() | {:raw, non_neg_integer()}

HyperLogLog write flags.

Accepts :default, :create_only, :update_only, :no_fail, :allow_fold, or a list of those atoms. Compatibility callers may pass a non-negative integer; use {:raw, integer} when deliberately sending an unnamed server value.

read_opts()

@type read_opts() :: []

Options accepted by multi-HLL read helpers.

No option keys are currently encoded for these read operations; the argument is accepted for API consistency.

t()

@opaque t()

Opaque HyperLogLog operation for Aerospike.operate/4.

write_opts()

@type write_opts() :: [{:flags, flags()}]

Options accepted by HyperLogLog modify operations.

Supported key:

  • :flags - HyperLogLog write flags. Defaults to :default.

Functions

add(bin_name, elements, index_bit_count \\ -1, min_hash_bit_count \\ -1, opts \\ [])

@spec add(String.t(), list(), integer(), integer(), write_opts()) :: t()

Adds elements to a HyperLogLog bin.

Elements may be strings or {:bytes, binary} values. If the bin is missing, the server creates it using the supplied bit counts.

describe(bin_name)

@spec describe(String.t()) :: t()

Returns [index_bit_count, min_hash_bit_count] for the HyperLogLog bin.

fold(bin_name, index_bit_count)

@spec fold(String.t(), integer()) :: t()

Folds the HyperLogLog bin to a smaller index bit count.

get_count(bin_name)

@spec get_count(String.t()) :: t()

Returns the estimated cardinality of the HyperLogLog bin.

get_intersect_count(bin_name, hlls, opts \\ [])

@spec get_intersect_count(String.t(), list(), read_opts()) :: t()

Returns the estimated cardinality of the intersection of the bin and hlls.

get_similarity(bin_name, hlls, opts \\ [])

@spec get_similarity(String.t(), list(), read_opts()) :: t()

Returns an estimated similarity score for the bin and hlls.

get_union(bin_name, hlls, opts \\ [])

@spec get_union(String.t(), list(), read_opts()) :: t()

Returns a HyperLogLog blob containing the union of the bin and hlls.

get_union_count(bin_name, hlls, opts \\ [])

@spec get_union_count(String.t(), list(), read_opts()) :: t()

Returns the estimated cardinality of the union of the bin and hlls.

init(bin_name, index_bit_count \\ -1, min_hash_bit_count \\ -1, opts \\ [])

@spec init(String.t(), integer(), integer(), write_opts()) :: t()

Creates a new HyperLogLog bin or resets an existing one.

refresh_count(bin_name)

@spec refresh_count(String.t()) :: t()

Refreshes stale cached cardinality and returns the estimated count.

set_union(bin_name, hlls, opts \\ [])

@spec set_union(String.t(), list(), write_opts()) :: t()

Merges every HyperLogLog value in hlls into the bin.

write_allow_fold()

@spec write_allow_fold() :: 8

Allow folding to less precise HyperLogLog settings when needed.

write_create_only()

@spec write_create_only() :: 1

Only create the HyperLogLog bin when it does not already exist.

write_default()

@spec write_default() :: 0

Use default HyperLogLog write behavior.

write_no_fail()

@spec write_no_fail() :: 4

Do not fail the command when a HyperLogLog operation is denied by write flags.

write_update_only()

@spec write_update_only() :: 2

Only update the HyperLogLog bin when it already exists.