ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - dalmatinerdb/ddb_client
Contribute to dalmatinerdb/ddb_client development by creating an account on GitHub.
Visit Site

GitHub - dalmatinerdb/ddb_client

GitHub - dalmatinerdb/ddb_client

DalmatinerDB Client

An Erlang TCP client for the dalmatiner time series database.

Firstly, in order to read or write data it is necessary to open a connection:

{ok, Con} = ddb_tcp:connect("127.0.0.1", 5555).

For efficiency reasons, the Dalmatiner TCP endpoint can only accept incoming data when switched to stream mode. Therefore, in order to write data points, a connection needs to be swtiched to stream mode as follows:

Bucket = <<"my_bucket">>.
%% The delay is the time in seconds before connection is automatically flushed.
Delay = 1.
{ok, SCon} = ddb_tcp:stream_mode(Bucket, Delay, Con).

Values should first be encoded in binary format using the mmath module, before attempting to write:

Timestamp = 1466072419.
Bucket = <<"my_bucket">>.
Metric = dproto:metric_from_list([<<"base">>, <<"cpu">>]).
Value  = mmath_bin:from_list([63.9, 64.0, 64.1]).
{ok, SCon1} = ddb_tcp:send(Metric, Timestamp, Value, SCon).

A stream connection is not required in order to perform read operations. In addition to listing metrics and buckets, data for a given point in time can be read as follows:

Timestamp = 1466072419.
Bucket = <<"my_bucket">>.
Metric = dproto:metric_from_list([<<"base">>, <<"cpu">>]).
Count = 3.
{ok, Data, Con1} = ddb_tcp:get(Bucket, Metric, Timestamp, Count, Con).

Finally, a connection should be closed when done:

Con1 = ddb_tcp:close(Con).

For more information, please consult the network protocol documentation.

Read options

It is possible to specify consistency parameters for an individual read operation if so required. The following options are available:

Read repair: {rr, off} - disables read repair for this get request {rr, on} - ensures read repairs for this read request, even on recently written data {rr, default} - will use the system defaults

Read quorum: {r, n} - will use the same value as N for this get request {r, R :: pos_integer()} - will use the value 0 < R <= N for this get request {r, default} - will use the system default for R

To use these options in a read request:

Timestamp = 1466072419.
Bucket = <<"my_bucket">>.
Metric = dproto:metric_from_list([<<"base">>, <<"cpu">>]).
Count = 3.
Opts = [{rr, off}, {r, 1}].
{ok, Data, Con1} = ddb_tcp:get(Bucket, Metric, Timestamp, Count, Opts, Con).

Connection pools

A DalmatinerDB connection is dedicated to send data to a single bucket. In cases where data is written to many buckets at once, it is more efficient to re-use an existing connection for a bucket instead of opening a new one. Applications such as Pooler may be used to pool and share connections to DDB.

Building the client

The client can be compiled using rebar3.

Linting rules are specified using the Elvis plugin, and lint rules may be checked by running:

$ rebar3 as lint lint

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory