locus_loader (locus v2.3.14)

View Source

Loads and unpacks databases while managing any associated assets (e.g. reading from and writing to cache)

Summary

Types

blob_format/0

-type blob_format() :: tgz | tarball | gzip | gzipped_mmdb | mmdb | unknown.

cacher_msg/0

-type cacher_msg() :: locus_filesystem_store:msg().

error_retry_behaviour/0

-type error_retry_behaviour() ::
          {backoff, milliseconds_interval()} | {exponential_backoff, exponential_backoff_params()}.

event/0

event_cache_attempt_finished/0

-type event_cache_attempt_finished() ::
          {cache_attempt_finished, locus_filesystem_store:path(), ok} |
          {cache_attempt_finished, locus_filesystem_store:path(), {error, term()}}.

exponential_backoff_params/0

-type exponential_backoff_params() ::
          #{min_interval := milliseconds_interval(),
            max_interval := milliseconds_interval(),
            growth_base := milliseconds_interval(),
            growth_exponent := number()}.

fetcher_msg/0

fetcher_opt/0

-type fetcher_opt() :: locus_maxmind_download:opt() | locus_http_download:opt().

fetcher_success/0

loader_opt/0

-type loader_opt() ::
          {update_period, milliseconds_interval()} |
          {error_retries, error_retry_behaviour()} |
          no_cache |
          {database_cache_file, file:filename_all()}.

maxmind_origin_params/0

-type maxmind_origin_params() :: #{license_key := unicode:unicode_binary(), date => calendar:date()}.

milliseconds_interval/0

-type milliseconds_interval() :: pos_integer().

msg/0

-type msg() ::
          {event, event()} |
          {load_success, source(), calendar:datetime(), locus_mmdb:database()} |
          {load_failure, source(), Reason :: term()}.

opt/0

-type opt() :: loader_opt() | fetcher_opt().

origin/0

-type origin() ::
          {maxmind, atom()} |
          {http, locus_http_download:url()} |
          {filesystem, locus_filesystem_load:path()} |
          locus:custom_fetcher().

provider_source/0

-type provider_source() :: {maxmind, atom()}.

settings/0

-type settings() ::
          #settings{update_period :: pos_integer(),
                    error_retry_behaviour :: error_retry_behaviour(),
                    error_retry_behaviour_applies_after_readiness :: boolean(),
                    use_cache :: boolean(),
                    database_cache_file :: file:filename_all() | undefined}.

source/0

state/0

-opaque state()

uniformly_distributed_update_period/0

-type uniformly_distributed_update_period() :: #{min := pos_integer(), max := pos_integer()}.

update_period/0

-type update_period() :: pos_integer() | uniformly_distributed_update_period().