Aphora v0.3.5 Aphora.Config View Source

This module provides a simple interface to the config.exs file, by providing a default variable fallback.

Link to this section Summary

Types

This can be any non-negative integer within the span of 0..31 and represents the datacenter/0 in which the worker/0 resides in.

This can be any non-negative integer and represents the epoch/0 with which the Aphora.Worker.timestamp/0 is generated.

This can be any non-negative integer within the span of 0..1_023 and represents the unique worker/0 within a datacenter/0.

Functions

Returns the set unique datacenter/0 identifier from the config, or otherwise the default value 0.

Returns the set unique epoch/0 identifier from the config, or otherwise the default value 1_546_300_800_000.

Returns the set unique worker/0 identifier from the config, or otherwise the default value 0.

Link to this section Types

Link to this type

datacenter() View Source (since 0.1.0)
datacenter() :: non_neg_integer()

This can be any non-negative integer within the span of 0..31 and represents the datacenter/0 in which the worker/0 resides in.

Link to this type

epoch() View Source (since 0.1.0)
epoch() :: non_neg_integer()

This can be any non-negative integer and represents the epoch/0 with which the Aphora.Worker.timestamp/0 is generated.

epoch/0 should never be changed after deploying IDs to prevent duplicates.

Link to this type

worker() View Source (since 0.1.0)
worker() :: non_neg_integer()

This can be any non-negative integer within the span of 0..1_023 and represents the unique worker/0 within a datacenter/0.

A worker/0 should never be assigned twice with the same ID within the same datacenter/0.

Link to this section Functions

Link to this function

get_datacenter() View Source (since 0.1.0)
get_datacenter() :: datacenter()

Returns the set unique datacenter/0 identifier from the config, or otherwise the default value 0.

Examples

iex> Aphora.Config.datacenter()
0
Link to this function

get_epoch() View Source (since 0.1.0)
get_epoch() :: epoch()

Returns the set unique epoch/0 identifier from the config, or otherwise the default value 1_546_300_800_000.

Examples

iex> Aphora.Config.epoch()
1546300800000000
Link to this function

get_worker() View Source (since 0.1.0)
get_worker() :: worker()

Returns the set unique worker/0 identifier from the config, or otherwise the default value 0.

Examples

iex> Aphora.Config.worker()
0