ExDataSketch.Backend behaviour (ExDataSketch v0.7.1)

Copy Markdown View Source

Behaviour defining the computation backend for ExDataSketch.

All sketch computations are dispatched through a backend module. This abstraction allows swapping between the pure Elixir implementation and an optional Rust NIF backend without changing the public API.

Implementing a Backend

A backend module must implement all callbacks defined in this behaviour. The canonical sketch state is always an Elixir binary. Backend functions receive and return binaries; they never own persistent sketch state.

Available Backends

Backend Selection

The backend is resolved in this order:

  1. Per-sketch :backend option (e.g., HLL.new(backend: Backend.Rust)).
  2. Application config: config :ex_data_sketch, backend: Backend.Pure.
  3. Default: ExDataSketch.Backend.Pure.

Summary

Callbacks

Return the number of set bits (popcount) in Bloom state.

Test membership of a single hash64 value in Bloom state.

Merge two Bloom state binaries (bitwise OR of bitsets).

Create a new Bloom filter state binary with the given options.

Update Bloom state by setting bit positions for a single hash64 value.

Update Bloom state by setting bit positions for a list of hash64 values.

Estimate the count for a given hash64 from CMS state.

Merge two CMS state binaries (element-wise add).

Create a new CMS state binary with the given options.

Update CMS state with a single hash64 and increment.

Update CMS state with a list of {hash64, increment} pairs.

Return the total count of all items from CQF state (sum of multiplicities).

Delete a single occurrence of hash64 from CQF state (decrement count).

Return the estimated count of a single hash64 in CQF state.

Test membership of a single hash64 value in CQF state.

Merge two CQF state binaries (multiset union: counts summed).

Create a new CQF state binary with the given options.

Insert a single hash64 into CQF state, incrementing its count.

Insert a list of hash64 values into CQF state.

Return the number of stored items from Cuckoo state.

Delete a single hash64 from Cuckoo state. Returns {:ok, state} or {:error, :not_found}.

Test membership of a single hash64 value in Cuckoo state.

Create a new Cuckoo filter state binary with the given options.

Insert a single hash64 into Cuckoo state. Returns {:ok, state} or {:error, :full}.

Insert a list of hash64 values into Cuckoo state. Returns {:ok, state} or {:error, :full, state}.

Return the count of items inserted into DDSketch state.

Return the maximum value in DDSketch state, or nil if empty.

Merge two DDSketch state binaries.

Return the minimum value in DDSketch state, or nil if empty.

Create a new DDSketch state binary with the given options.

Return the approximate value at a given normalized rank from DDSketch state.

Return the approximate normalized rank of a given value from DDSketch state.

Update DDSketch state with a single float64 value.

Update DDSketch state with a list of float64 values in a single pass.

Return the total count of observed items from FrequentItems state.

Return the number of distinct tracked entries from FrequentItems state.

Return the frequency estimate for a given item_bytes from FrequentItems state.

Merge two FrequentItems state binaries.

Create a new FrequentItems state binary with the given options.

Return the top-k entries sorted by count descending from FrequentItems state.

Update FrequentItems state with a single item_bytes value.

Update FrequentItems state with a list of item_bytes values in a single pass.

Estimate cardinality from HLL state.

Merge two HLL state binaries (register-wise max).

Create a new HLL state binary with the given options.

Update HLL state with a single hash64 value.

Update HLL state with a list of hash64 values in a single pass.

Return the item count from IBLT state.

Delete a key_hash and value_hash from IBLT state.

List entries by peeling the IBLT. Returns {:ok, entries} or {:error, :decode_failed}.

Test membership of a single key_hash in IBLT state.

Merge two IBLT state binaries cell-wise (set union).

Create a new IBLT state binary with the given options.

Insert a key_hash and value_hash into IBLT state.

Insert a list of {key_hash, value_hash} pairs into IBLT state.

Subtract two IBLT state binaries cell-wise (set difference).

Return the CDF at the given split points from KLL state.

Return the count of items inserted into KLL state.

Return the maximum value in KLL state, or nil if empty.

Merge two KLL state binaries.

Return the minimum value in KLL state, or nil if empty.

Create a new KLL state binary with the given options.

Return the PMF at the given split points from KLL state.

Return the approximate value at a given normalized rank from KLL state.

Return the approximate normalized rank of a given value from KLL state.

Update KLL state with a single float64 value.

Update KLL state with a list of float64 values in a single pass.

Return the total count of observed items from MisraGries state.

Return the number of distinct tracked entries from MisraGries state.

Return the frequency estimate for a given item_bytes from MisraGries state.

Merge two MisraGries state binaries.

Create a new MisraGries state binary with the given options.

Return the top-k entries sorted by count descending from MisraGries state.

Update MisraGries state with a single item_bytes value.

Update MisraGries state with a list of item_bytes values in a single pass.

Return the number of stored items from Quotient state.

Delete a single hash64 from Quotient state.

Test membership of a single hash64 value in Quotient state.

Merge two Quotient state binaries.

Create a new Quotient filter state binary with the given options.

Insert a single hash64 into Quotient state.

Insert a list of hash64 values into Quotient state.

Return the CDF at the given split points from REQ state.

Return the count of items inserted into REQ state.

Return the maximum value in REQ state, or nil if empty.

Merge two REQ state binaries.

Return the minimum value in REQ state, or nil if empty.

Create a new REQ state binary with the given options.

Return the PMF at the given split points from REQ state.

Return the approximate value at a given normalized rank from REQ state.

Return the approximate normalized rank of a given value from REQ state.

Update REQ state with a single float64 value.

Update REQ state with a list of float64 values in a single pass.

Compact Theta state: sort entries and discard any above theta.

Estimate cardinality from Theta state.

Build Theta state binary from raw components (k, theta, sorted entries list).

Merge two Theta state binaries (set union).

Create a new Theta state binary with the given options.

Update Theta state with a single hash64 value.

Update Theta state with a list of hash64 values in a single pass.

Estimate cardinality from ULL state.

Merge two ULL state binaries (register-wise max).

Create a new ULL state binary with the given options.

Update ULL state with a single hash64 value.

Update ULL state with a list of hash64 values in a single pass.

Build an XorFilter from a list of hash64 values. Returns {:ok, state} or {:error, :build_failed}.

Return the number of items the XorFilter was built from.

Test membership of a single hash64 value in XorFilter state.

Functions

Returns the default backend module.

Resolves the backend from options or application config.

Types

hash64()

@type hash64() :: non_neg_integer()

opts()

@type opts() :: keyword()

state_bin()

@type state_bin() :: binary()

Callbacks

bloom_count(state_bin, opts)

@callback bloom_count(state_bin(), opts()) :: non_neg_integer()

Return the number of set bits (popcount) in Bloom state.

bloom_member?(state_bin, hash64, opts)

@callback bloom_member?(state_bin(), hash64(), opts()) :: boolean()

Test membership of a single hash64 value in Bloom state.

bloom_merge(state_bin, state_bin, opts)

@callback bloom_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two Bloom state binaries (bitwise OR of bitsets).

bloom_new(opts)

@callback bloom_new(opts()) :: state_bin()

Create a new Bloom filter state binary with the given options.

bloom_put(state_bin, hash64, opts)

@callback bloom_put(state_bin(), hash64(), opts()) :: state_bin()

Update Bloom state by setting bit positions for a single hash64 value.

bloom_put_many(state_bin, list, opts)

@callback bloom_put_many(state_bin(), [hash64()], opts()) :: state_bin()

Update Bloom state by setting bit positions for a list of hash64 values.

cms_estimate(state_bin, hash64, opts)

@callback cms_estimate(state_bin(), hash64(), opts()) :: non_neg_integer()

Estimate the count for a given hash64 from CMS state.

cms_merge(state_bin, state_bin, opts)

@callback cms_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two CMS state binaries (element-wise add).

cms_new(opts)

@callback cms_new(opts()) :: state_bin()

Create a new CMS state binary with the given options.

cms_update(state_bin, hash64, pos_integer, opts)

@callback cms_update(state_bin(), hash64(), pos_integer(), opts()) :: state_bin()

Update CMS state with a single hash64 and increment.

cms_update_many(state_bin, list, opts)

@callback cms_update_many(state_bin(), [{hash64(), pos_integer()}], opts()) :: state_bin()

Update CMS state with a list of {hash64, increment} pairs.

cqf_count(state_bin, opts)

@callback cqf_count(state_bin(), opts()) :: non_neg_integer()

Return the total count of all items from CQF state (sum of multiplicities).

cqf_delete(state_bin, hash64, opts)

@callback cqf_delete(state_bin(), hash64(), opts()) :: state_bin()

Delete a single occurrence of hash64 from CQF state (decrement count).

cqf_estimate_count(state_bin, hash64, opts)

@callback cqf_estimate_count(state_bin(), hash64(), opts()) :: non_neg_integer()

Return the estimated count of a single hash64 in CQF state.

cqf_member?(state_bin, hash64, opts)

@callback cqf_member?(state_bin(), hash64(), opts()) :: boolean()

Test membership of a single hash64 value in CQF state.

cqf_merge(state_bin, state_bin, opts)

@callback cqf_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two CQF state binaries (multiset union: counts summed).

cqf_new(opts)

@callback cqf_new(opts()) :: state_bin()

Create a new CQF state binary with the given options.

cqf_put(state_bin, hash64, opts)

@callback cqf_put(state_bin(), hash64(), opts()) :: state_bin()

Insert a single hash64 into CQF state, incrementing its count.

cqf_put_many(state_bin, list, opts)

@callback cqf_put_many(state_bin(), [hash64()], opts()) :: state_bin()

Insert a list of hash64 values into CQF state.

cuckoo_count(state_bin, opts)

@callback cuckoo_count(state_bin(), opts()) :: non_neg_integer()

Return the number of stored items from Cuckoo state.

cuckoo_delete(state_bin, hash64, opts)

@callback cuckoo_delete(state_bin(), hash64(), opts()) ::
  {:ok, state_bin()} | {:error, :not_found}

Delete a single hash64 from Cuckoo state. Returns {:ok, state} or {:error, :not_found}.

cuckoo_member?(state_bin, hash64, opts)

@callback cuckoo_member?(state_bin(), hash64(), opts()) :: boolean()

Test membership of a single hash64 value in Cuckoo state.

cuckoo_new(opts)

@callback cuckoo_new(opts()) :: state_bin()

Create a new Cuckoo filter state binary with the given options.

cuckoo_put(state_bin, hash64, opts)

@callback cuckoo_put(state_bin(), hash64(), opts()) ::
  {:ok, state_bin()} | {:error, :full}

Insert a single hash64 into Cuckoo state. Returns {:ok, state} or {:error, :full}.

cuckoo_put_many(state_bin, list, opts)

@callback cuckoo_put_many(state_bin(), [hash64()], opts()) ::
  {:ok, state_bin()} | {:error, :full, state_bin()}

Insert a list of hash64 values into Cuckoo state. Returns {:ok, state} or {:error, :full, state}.

ddsketch_count(state_bin, opts)

@callback ddsketch_count(state_bin(), opts()) :: non_neg_integer()

Return the count of items inserted into DDSketch state.

ddsketch_max(state_bin, opts)

@callback ddsketch_max(state_bin(), opts()) :: float() | nil

Return the maximum value in DDSketch state, or nil if empty.

ddsketch_merge(state_bin, state_bin, opts)

@callback ddsketch_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two DDSketch state binaries.

ddsketch_min(state_bin, opts)

@callback ddsketch_min(state_bin(), opts()) :: float() | nil

Return the minimum value in DDSketch state, or nil if empty.

ddsketch_new(opts)

@callback ddsketch_new(opts()) :: state_bin()

Create a new DDSketch state binary with the given options.

ddsketch_quantile(state_bin, float, opts)

@callback ddsketch_quantile(state_bin(), float(), opts()) :: float() | nil

Return the approximate value at a given normalized rank from DDSketch state.

ddsketch_rank(state_bin, float, opts)

@callback ddsketch_rank(state_bin(), float(), opts()) :: float() | nil

Return the approximate normalized rank of a given value from DDSketch state.

ddsketch_update(state_bin, float, opts)

@callback ddsketch_update(state_bin(), float(), opts()) :: state_bin()

Update DDSketch state with a single float64 value.

ddsketch_update_many(state_bin, list, opts)

@callback ddsketch_update_many(state_bin(), [float()], opts()) :: state_bin()

Update DDSketch state with a list of float64 values in a single pass.

fi_count(state_bin, opts)

@callback fi_count(state_bin(), opts()) :: non_neg_integer()

Return the total count of observed items from FrequentItems state.

fi_entry_count(state_bin, opts)

@callback fi_entry_count(state_bin(), opts()) :: non_neg_integer()

Return the number of distinct tracked entries from FrequentItems state.

fi_estimate(state_bin, binary, opts)

@callback fi_estimate(state_bin(), binary(), opts()) ::
  {:ok, map()} | {:error, :not_tracked}

Return the frequency estimate for a given item_bytes from FrequentItems state.

fi_merge(state_bin, state_bin, opts)

@callback fi_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two FrequentItems state binaries.

fi_new(opts)

@callback fi_new(opts()) :: state_bin()

Create a new FrequentItems state binary with the given options.

fi_top_k(state_bin, non_neg_integer, opts)

@callback fi_top_k(state_bin(), non_neg_integer(), opts()) :: [map()]

Return the top-k entries sorted by count descending from FrequentItems state.

fi_update(state_bin, binary, opts)

@callback fi_update(state_bin(), binary(), opts()) :: state_bin()

Update FrequentItems state with a single item_bytes value.

fi_update_many(state_bin, list, opts)

@callback fi_update_many(state_bin(), [binary()], opts()) :: state_bin()

Update FrequentItems state with a list of item_bytes values in a single pass.

hll_estimate(state_bin, opts)

@callback hll_estimate(state_bin(), opts()) :: float()

Estimate cardinality from HLL state.

hll_merge(state_bin, state_bin, opts)

@callback hll_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two HLL state binaries (register-wise max).

hll_new(opts)

@callback hll_new(opts()) :: state_bin()

Create a new HLL state binary with the given options.

hll_update(state_bin, hash64, opts)

@callback hll_update(state_bin(), hash64(), opts()) :: state_bin()

Update HLL state with a single hash64 value.

hll_update_many(state_bin, list, opts)

@callback hll_update_many(state_bin(), [hash64()], opts()) :: state_bin()

Update HLL state with a list of hash64 values in a single pass.

iblt_count(state_bin, opts)

@callback iblt_count(state_bin(), opts()) :: non_neg_integer()

Return the item count from IBLT state.

iblt_delete(state_bin, hash64, hash64, opts)

@callback iblt_delete(state_bin(), hash64(), hash64(), opts()) :: state_bin()

Delete a key_hash and value_hash from IBLT state.

iblt_list_entries(state_bin, opts)

@callback iblt_list_entries(state_bin(), opts()) ::
  {:ok, %{positive: [{hash64(), hash64()}], negative: [{hash64(), hash64()}]}}
  | {:error, :decode_failed}

List entries by peeling the IBLT. Returns {:ok, entries} or {:error, :decode_failed}.

iblt_member?(state_bin, hash64, opts)

@callback iblt_member?(state_bin(), hash64(), opts()) :: boolean()

Test membership of a single key_hash in IBLT state.

iblt_merge(state_bin, state_bin, opts)

@callback iblt_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two IBLT state binaries cell-wise (set union).

iblt_new(opts)

@callback iblt_new(opts()) :: state_bin()

Create a new IBLT state binary with the given options.

iblt_put(state_bin, hash64, hash64, opts)

@callback iblt_put(state_bin(), hash64(), hash64(), opts()) :: state_bin()

Insert a key_hash and value_hash into IBLT state.

iblt_put_many(state_bin, list, opts)

@callback iblt_put_many(state_bin(), [{hash64(), hash64()}], opts()) :: state_bin()

Insert a list of {key_hash, value_hash} pairs into IBLT state.

iblt_subtract(state_bin, state_bin, opts)

@callback iblt_subtract(state_bin(), state_bin(), opts()) :: state_bin()

Subtract two IBLT state binaries cell-wise (set difference).

kll_cdf(state_bin, list, opts)

@callback kll_cdf(state_bin(), [float()], opts()) :: [float()] | nil

Return the CDF at the given split points from KLL state.

kll_count(state_bin, opts)

@callback kll_count(state_bin(), opts()) :: non_neg_integer()

Return the count of items inserted into KLL state.

kll_max(state_bin, opts)

@callback kll_max(state_bin(), opts()) :: float() | nil

Return the maximum value in KLL state, or nil if empty.

kll_merge(state_bin, state_bin, opts)

@callback kll_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two KLL state binaries.

kll_min(state_bin, opts)

@callback kll_min(state_bin(), opts()) :: float() | nil

Return the minimum value in KLL state, or nil if empty.

kll_new(opts)

@callback kll_new(opts()) :: state_bin()

Create a new KLL state binary with the given options.

kll_pmf(state_bin, list, opts)

@callback kll_pmf(state_bin(), [float()], opts()) :: [float()] | nil

Return the PMF at the given split points from KLL state.

kll_quantile(state_bin, float, opts)

@callback kll_quantile(state_bin(), float(), opts()) :: float() | nil

Return the approximate value at a given normalized rank from KLL state.

kll_rank(state_bin, float, opts)

@callback kll_rank(state_bin(), float(), opts()) :: float() | nil

Return the approximate normalized rank of a given value from KLL state.

kll_update(state_bin, float, opts)

@callback kll_update(state_bin(), float(), opts()) :: state_bin()

Update KLL state with a single float64 value.

kll_update_many(state_bin, list, opts)

@callback kll_update_many(state_bin(), [float()], opts()) :: state_bin()

Update KLL state with a list of float64 values in a single pass.

mg_count(state_bin, opts)

@callback mg_count(state_bin(), opts()) :: non_neg_integer()

Return the total count of observed items from MisraGries state.

mg_entry_count(state_bin, opts)

@callback mg_entry_count(state_bin(), opts()) :: non_neg_integer()

Return the number of distinct tracked entries from MisraGries state.

mg_estimate(state_bin, binary, opts)

@callback mg_estimate(state_bin(), binary(), opts()) :: non_neg_integer()

Return the frequency estimate for a given item_bytes from MisraGries state.

mg_merge(state_bin, state_bin, opts)

@callback mg_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two MisraGries state binaries.

mg_new(opts)

@callback mg_new(opts()) :: state_bin()

Create a new MisraGries state binary with the given options.

mg_top_k(state_bin, non_neg_integer, opts)

@callback mg_top_k(state_bin(), non_neg_integer(), opts()) :: [
  {binary(), non_neg_integer()}
]

Return the top-k entries sorted by count descending from MisraGries state.

mg_update(state_bin, binary, opts)

@callback mg_update(state_bin(), binary(), opts()) :: state_bin()

Update MisraGries state with a single item_bytes value.

mg_update_many(state_bin, list, opts)

@callback mg_update_many(state_bin(), [binary()], opts()) :: state_bin()

Update MisraGries state with a list of item_bytes values in a single pass.

quotient_count(state_bin, opts)

@callback quotient_count(state_bin(), opts()) :: non_neg_integer()

Return the number of stored items from Quotient state.

quotient_delete(state_bin, hash64, opts)

@callback quotient_delete(state_bin(), hash64(), opts()) :: state_bin()

Delete a single hash64 from Quotient state.

quotient_member?(state_bin, hash64, opts)

@callback quotient_member?(state_bin(), hash64(), opts()) :: boolean()

Test membership of a single hash64 value in Quotient state.

quotient_merge(state_bin, state_bin, opts)

@callback quotient_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two Quotient state binaries.

quotient_new(opts)

@callback quotient_new(opts()) :: state_bin()

Create a new Quotient filter state binary with the given options.

quotient_put(state_bin, hash64, opts)

@callback quotient_put(state_bin(), hash64(), opts()) :: state_bin()

Insert a single hash64 into Quotient state.

quotient_put_many(state_bin, list, opts)

@callback quotient_put_many(state_bin(), [hash64()], opts()) :: state_bin()

Insert a list of hash64 values into Quotient state.

req_cdf(state_bin, list, opts)

@callback req_cdf(state_bin(), [float()], opts()) :: [float()] | nil

Return the CDF at the given split points from REQ state.

req_count(state_bin, opts)

@callback req_count(state_bin(), opts()) :: non_neg_integer()

Return the count of items inserted into REQ state.

req_max(state_bin, opts)

@callback req_max(state_bin(), opts()) :: float() | nil

Return the maximum value in REQ state, or nil if empty.

req_merge(state_bin, state_bin, opts)

@callback req_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two REQ state binaries.

req_min(state_bin, opts)

@callback req_min(state_bin(), opts()) :: float() | nil

Return the minimum value in REQ state, or nil if empty.

req_new(opts)

@callback req_new(opts()) :: state_bin()

Create a new REQ state binary with the given options.

req_pmf(state_bin, list, opts)

@callback req_pmf(state_bin(), [float()], opts()) :: [float()] | nil

Return the PMF at the given split points from REQ state.

req_quantile(state_bin, float, opts)

@callback req_quantile(state_bin(), float(), opts()) :: float() | nil

Return the approximate value at a given normalized rank from REQ state.

req_rank(state_bin, float, opts)

@callback req_rank(state_bin(), float(), opts()) :: float() | nil

Return the approximate normalized rank of a given value from REQ state.

req_update(state_bin, float, opts)

@callback req_update(state_bin(), float(), opts()) :: state_bin()

Update REQ state with a single float64 value.

req_update_many(state_bin, list, opts)

@callback req_update_many(state_bin(), [float()], opts()) :: state_bin()

Update REQ state with a list of float64 values in a single pass.

theta_compact(state_bin, opts)

@callback theta_compact(state_bin(), opts()) :: state_bin()

Compact Theta state: sort entries and discard any above theta.

theta_estimate(state_bin, opts)

@callback theta_estimate(state_bin(), opts()) :: float()

Estimate cardinality from Theta state.

theta_from_components(non_neg_integer, non_neg_integer, list)

@callback theta_from_components(non_neg_integer(), non_neg_integer(), [non_neg_integer()]) ::
  state_bin()

Build Theta state binary from raw components (k, theta, sorted entries list).

theta_merge(state_bin, state_bin, opts)

@callback theta_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two Theta state binaries (set union).

theta_new(opts)

@callback theta_new(opts()) :: state_bin()

Create a new Theta state binary with the given options.

theta_update(state_bin, hash64, opts)

@callback theta_update(state_bin(), hash64(), opts()) :: state_bin()

Update Theta state with a single hash64 value.

theta_update_many(state_bin, list, opts)

@callback theta_update_many(state_bin(), [hash64()], opts()) :: state_bin()

Update Theta state with a list of hash64 values in a single pass.

ull_estimate(state_bin, opts)

@callback ull_estimate(state_bin(), opts()) :: float()

Estimate cardinality from ULL state.

ull_merge(state_bin, state_bin, opts)

@callback ull_merge(state_bin(), state_bin(), opts()) :: state_bin()

Merge two ULL state binaries (register-wise max).

ull_new(opts)

@callback ull_new(opts()) :: state_bin()

Create a new ULL state binary with the given options.

ull_update(state_bin, hash64, opts)

@callback ull_update(state_bin(), hash64(), opts()) :: state_bin()

Update ULL state with a single hash64 value.

ull_update_many(state_bin, list, opts)

@callback ull_update_many(state_bin(), [hash64()], opts()) :: state_bin()

Update ULL state with a list of hash64 values in a single pass.

xor_build(list, opts)

@callback xor_build([hash64()], opts()) :: {:ok, state_bin()} | {:error, :build_failed}

Build an XorFilter from a list of hash64 values. Returns {:ok, state} or {:error, :build_failed}.

xor_count(state_bin, opts)

@callback xor_count(state_bin(), opts()) :: non_neg_integer()

Return the number of items the XorFilter was built from.

xor_member?(state_bin, hash64, opts)

@callback xor_member?(state_bin(), hash64(), opts()) :: boolean()

Test membership of a single hash64 value in XorFilter state.

Functions

default()

@spec default() :: module()

Returns the default backend module.

Checks application config first, falls back to ExDataSketch.Backend.Pure.

Examples

iex> backend = ExDataSketch.Backend.default()
iex> backend == ExDataSketch.Backend.Pure
true

resolve(opts)

@spec resolve(keyword()) :: module()

Resolves the backend from options or application config.

Examples

iex> ExDataSketch.Backend.resolve(backend: ExDataSketch.Backend.Pure)
ExDataSketch.Backend.Pure

iex> ExDataSketch.Backend.resolve([])
ExDataSketch.Backend.Pure