Module dqe_idx

Call back module and wrapper for the Dalmatiner Query Engine Indexer.

Copyright © (C) 2016, Project-FiFo UG

This module defines the dqe_idx behaviour.
Required callback functions: init/0, lookup/1, lookup/2, lookup_tags/1, collections/0, metrics/1, namespaces/2, tags/3, values/4, expand/2, add/4, add/5, update/5, delete/4, delete/5.

Description

Call back module and wrapper for the Dalmatiner Query Engine Indexer. This module should be used in place of calling different indexer backends.

Data Types

bucket()

bucket() = binary()

collection()

collection() = binary()

glob_metric()

glob_metric() = [binary() | '*']

group_by_field()

group_by_field() = binary()

key()

key() = binary()

lqry()

lqry() = {in, collection(), [metric()]} | {in, collection(), [metric()], where()}

metric()

metric() = binary()

namespace()

namespace() = binary()

tag()

tag() = {tag, Namespace::namespace(), TagName::tag_name()}

tag_name()

tag_name() = binary()

tag_value()

tag_value() = binary()

tags()

tags() = [{Namespace::namespace(), TagName::tag_name(), Value::tag_value()}]

where()

where() = {'=', tag(), tag_value()} | {'and', where(), where()} | {'or', where(), where()}

Function Index

add/4 Links a collection/metric to a bucket and key.
add/5 Adds one or more metrics tag pairs to a metric.
collections/0 Lists all collections.
delete/4 Deletes a Collection/Metric pair and all it's tags.
delete/5 Deletes one or more tag pairs from a Metric.
expand/2 Expands a glob into all matching metrics for a given bucket.
init/0 Initializes the Dalmatiner Query Engine indexer, this will hand down to whatever indexing backend is used.
lookup/1 Takes a lookup query and reutrns a list of all metric/bucket paris that metch the lookup criteria.
lookup/2 Takes a lookup query and reutrns a list of all metric/bucket paris that metch the lookup criteria with the values for the provided group by fields (tags).
lookup_tags/1 Find all possible namespace, tag, value pairs for a query.
metrics/1 Lists all metrics in a collections.
namespaces/2 Lists all namespaces for a metrics.
tags/3 Lists all tags for a namespaces metrics.
update/5 Updates values of a metric, this behaves equivalent to add/5 if the metric was not yet known to the index store, if however it was known it MUST add new tags and MUST update existing tags.
values/4 Lists all the possible values for a tag.

Function Details

add/4

add(Collection::collection(), Metric::metric(), Bucket::bucket(), Key::key()) -> {ok, MetricIdx::term()} | ok | {error, Error::term()}

Links a collection/metric to a bucket and key. Returns whatever identifyer the colleciton/metric has if any. This MAY either return {ok, ID} or optinally ok, if ok is returned it MUST only be done if the metric was already present in the index store. Returning {ok, ID} is ALWAYS acceptable. A consumer of this API MAY assume that if ok is returned the related tags are already in the store as well.

add/5

add(Collection::collection(), Metric::metric(), Bucket::bucket(), Key::key(), Tags::[{namespace(), tag_name(), tag_value()}]) -> {ok, MetricIdx::term()} | ok | {error, Error::term()}

Adds one or more metrics tag pairs to a metric. This function MUST not change existing tags, or add tags to an existing metric IF add/4 returned ok. It MAY add additional tags if add/4 returned {ok, ID} despite the metric being present.

collections/0

collections() -> {ok, [collection()]} | {error, Error::term()}

Lists all collections.

delete/4

delete(Collection::collection(), Metric::metric(), Bucket::bucket(), Key::key()) -> ok | {error, Error::term()}

Deletes a Collection/Metric pair and all it's tags.

delete/5

delete(Collection::collection(), Metric::metric(), Bucket::bucket(), Key::key(), Tags::[{namespace(), tag_name()}]) -> ok | {error, Error::term()}

Deletes one or more tag pairs from a Metric. This funciton can call delete/6 multiple times or use a more optimized method. This MUST only be used with metric2.0 like metadata tags that do not change metric identity!

expand/2

expand(B::bucket(), Gs::[glob_metric()]) -> {ok, {bucket(), [metric()]}} | {error, Error::term()}

Expands a glob into all matching metrics for a given bucket. WARNING: This might go away!

init/0

init() -> ok | {error, Error::term()}

Initializes the Dalmatiner Query Engine indexer, this will hand down to whatever indexing backend is used.

lookup/1

lookup(Query::lqry()) -> {ok, [{bucket(), key()}]} | {error, Error::term()}

Takes a lookup query and reutrns a list of all metric/bucket paris that metch the lookup criteria.

lookup/2

lookup(Query::lqry(), GroupBy::[group_by_field()]) -> {ok, [{bucket(), key(), [group_by_field()]}]} | {error, Error::term()}

Takes a lookup query and reutrns a list of all metric/bucket paris that metch the lookup criteria with the values for the provided group by fields (tags).

lookup_tags/1

lookup_tags(Query::lqry()) -> {ok, tags()} | {error, Error::term()}

Find all possible namespace, tag, value pairs for a query.

metrics/1

metrics(Collection::collection()) -> {ok, [metric()]} | {error, Error::term()}

Lists all metrics in a collections.

namespaces/2

namespaces(Collection::collection(), Metric::metric()) -> {ok, [namespace()]} | {error, Error::term()}

Lists all namespaces for a metrics.

tags/3

tags(Collection::collection(), Metric::metric(), Namesplace::namespace()) -> {ok, [tag_name()]} | {error, Error::term()}

Lists all tags for a namespaces metrics.

update/5

update(Collection::collection(), Metric::metric(), Bucket::bucket(), Key::key(), Tags::[{namespace(), tag_name(), tag_value()}]) -> {ok, MetricIdx::term()} | ok | {error, Error::term()}

Updates values of a metric, this behaves equivalent to add/5 if the metric was not yet known to the index store, if however it was known it MUST add new tags and MUST update existing tags. This is meant to be used with metadata tags as described in the metrics2.0 specification.

values/4

values(Collection::collection(), Metric::metric(), Namesplace::namespace(), Tag::tag_name()) -> {ok, [tag_value()]} | {error, Error::term()}

Lists all the possible values for a tag


Generated by EDoc, May 24 2016, 11:36:52.