custom_fetcher() = {custom_fetcher, module(), Args::term()}
database_edition() = maxmind_database_edition()
database_entry() = locus_mmdb_data:value()
database_error() = database_unknown | database_not_loaded
database_info() = #{metadata := database_metadata(), source := database_source(), version := database_version()}
database_metadata() = locus_mmdb_metadata:t()
database_source() = locus_loader:source()
database_url() = unicode:chardata()
database_version() = calendar:datetime()
ip_address_prefix() = locus_mmdb_tree:ip_address_prefix()
legacy_maxmind_database_edition() = atom()
maxmind_database_edition() = {maxmind, atom() | unicode:chardata()} | legacy_maxmind_database_edition()
await_loader/1 | Like await_loader/1 but with a default timeout of 30 seconds. |
await_loader/2 | Blocks caller execution until either readiness is achieved or the default timeout is triggered. |
await_loaders/2 | Like await_loader/2 but it can concurrently await status from more than one database. |
check/1 | Analyzes a loaded database for corruption or incompatibility. |
get_info/1 | Returns the properties of a currently loaded database. |
get_info/2 | Returns a specific property of a currently loaded database. |
loader_child_spec/2 | Like :loader_child_spec/2 but with default options. |
loader_child_spec/3 | Like :loader_child_spec/3 but with default child id. |
loader_child_spec/4 | Returns a supervisor child spec for a database loader
under id DatabaseId with options Opts . |
lookup/2 | Looks-up info on IPv4 and IPv6 addresses. |
start_loader/2 | Like :start_loader/3 but with default options. |
start_loader/3 | Starts a database loader under id DatabaseId with options Opts . |
stop_loader/1 | Stops the database loader under id DatabaseId . |
await_loader(DatabaseId) -> {ok, LoadedVersion} | {error, Reason}
Like await_loader/1
but with a default timeout of 30 seconds.
DatabaseId
must be an atom and refer to a database loader.{ok, LoadedVersion}
when the database is ready to use.{error, database_unknown}
if the database loader for DatabaseId
hasn't been started.{error, {database_stopped, _}}
if the database loader for DatabaseId
stopped while we waited.{error, {timeout, [_]}}
if all the load attempts performed before timing out have failed.See also: await_loader/2.
await_loader(DatabaseId, Timeout) -> {ok, LoadedVersion} | {error, Reason}
Blocks caller execution until either readiness is achieved or the default timeout is triggered.
DatabaseId
must be an atom and refer to a database loader.Timeout
must be either a non-negative integer (milliseconds) or infinity
.{ok, LoadedVersion}
when the database is ready to use.{error, database_unknown}
if the database loader for DatabaseId
hasn't been started.{error, {database_stopped, _}}
if the database loader for DatabaseId
stopped while we waited.{error, {timeout, [_]}}
if all the load attempts performed before timing out have failed.See also: await_loader/1, await_loaders/2.
await_loaders(DatabaseIds, Timeout) -> {ok, Successes} | {error, {ErrorPerDatabase, PartialSuccesses}}
Like await_loader/2
but it can concurrently await status from more than one database.
DatabaseIds
must be list of atom referring to database loaders.Timeout
must be either a non-negative integer (milliseconds) or infinity
.{ok, #{DatabaseId => LoadedVersion}}
when all the database are ready to use.{error, {#{DatabaseId => ErrorReason}, _}}
in case of errors.See also: await_loader/2.
check(DatabaseId) -> ok | {error, Error} | {validation_warnings, [ValidationWarning, ...]} | {validation_errors, [ValidationError, ...], [ValidationWarning]}
Analyzes a loaded database for corruption or incompatibility.
DatabaseId
must be an atom and refer to a database loader.ok
if the database is wholesome.{error, database_unknown}
if the database loader for DatabaseId
hasn't been started.{error, database_not_loaded}
if the database hasn't yet been loaded.{validation_warnings, [CheckWarning, ...]}
in case something smells within the database
(see the definition of locus_mmdb_check:warning/0
)
{validation_errors, [CheckError], [...]}
in case of corruption or incompatibility
(see the definition of locus_mmdb_check:error/0
)
get_info(DatabaseId) -> {ok, Info} | {error, Error}
Returns the properties of a currently loaded database.
DatabaseId
must be an atom and refer to a database loader.{ok, database_info()}
in case of success{error, database_unknown}
if the database loader for DatabaseId
hasn't been started.{error, database_not_loaded}
if the database hasn't yet been loaded.See also: get_info/2.
get_info(DatabaseId, Property) -> {ok, Value} | {error, Error}
Returns a specific property of a currently loaded database.
DatabaseId
must be an atom and refer to a database loader.Property
must be either metadata
, source
or version
.{ok, Value}
in case of success{error, database_unknown}
if the database loader for DatabaseId
hasn't been started.{error, database_not_loaded}
if the database hasn't yet been loaded.See also: get_info/1.
loader_child_spec(DatabaseId, LoadFrom) -> ChildSpec | no_return()
Like :loader_child_spec/2
but with default options
DatabaseId
must be an atom.LoadFrom
must be either:
database_edition()
tuple, orDatabaseURL
containing either a string or binary representation
of a HTTP(s) URL or local path, or{custom_fetcher, Module, Args}
tuple, with Module
implementing
the locus_custom_fetcher
behavioursupervisor:child_spec()
.See also: await_loader/1, await_loader/2, loader_child_spec/3, start_loader/2.
loader_child_spec(DatabaseId, LoadFrom, Opts) -> ChildSpec | no_return()
Like :loader_child_spec/3
but with default child id
DatabaseId
must be an atom.LoadFrom
must be either:
database_edition()
tuple, orDatabaseURL
containing either a string or binary representation
of a HTTP(s) URL or local path, or{custom_fetcher, Module, Args}
tuple, with Module
implementing
the locus_custom_fetcher
behaviourOpts
must be a list of locus_database:opt()
valuessupervisor:child_spec()
.See also: await_loader/1, await_loader/2, loader_child_spec/2, loader_child_spec/4, start_loader/3.
loader_child_spec(ChildId, DatabaseId, LoadFrom, Opts) -> ChildSpec | no_return()
Returns a supervisor child spec for a database loader
under id DatabaseId
with options Opts
.
DatabaseId
must be an atom.LoadFrom
must be either:
database_edition()
tuple, orDatabaseURL
containing either a string or binary representation
of a HTTP(s) URL or local path, or{custom_fetcher, Module, Args}
tuple, with Module
implementing
the locus_custom_fetcher
behaviourOpts
must be a list of locus_database:opt()
valuessupervisor:child_spec()
.See also: await_loader/1, await_loader/2, loader_child_spec/3, start_loader/3.
lookup(DatabaseId, Address) -> {ok, Entry} | not_found | {error, Error}
Looks-up info on IPv4 and IPv6 addresses.
DatabaseId
must be an atom and refer to a database loader.Address
must be either an inet:ip_address()
tuple, or a string/binary
containing a valid representation of the address.{ok, Entry}
in case of successnot_found
if no data was found for this Address
.{error, invalid_address}
if Address
is not either a inet:ip_address()
tuple or a valid textual representation of an IP address.{error, database_unknown}
if the database loader for DatabaseId
hasn't been started.{error, database_not_loaded}
if the database hasn't yet been loaded.{error, ipv4_database}
if Address
represents an IPv6 address and the database
only supports IPv4 addresses.start_loader(DatabaseId, LoadFrom) -> ok | {error, Error}
Like :start_loader/3
but with default options
DatabaseId
must be an atom.LoadFrom
must be either:
database_edition()
tuple, orDatabaseURL
containing either a string or binary representation
of a HTTP(s) URL or local path, or{custom_fetcher, Module, Args}
tuple, with Module
implementing
the locus_custom_fetcher
behaviourok
in case of success.{error, invalid_url}
if the source is invalid.{error, already_started}
if the loader under DatabaseId
has already been started.See also: await_loader/1, await_loader/2, start_loader/1, start_loader/3.
start_loader(DatabaseId, LoadFrom, Opts) -> ok | {error, Error}
Starts a database loader under id DatabaseId
with options Opts
.
DatabaseId
must be an atom.LoadFrom
must be either:
database_edition()
tuple, orDatabaseURL
containing either a string or binary representation
of a HTTP(s) URL or local path, or{custom_fetcher, Module, Args}
tuple, with Module
implementing
the locus_custom_fetcher
behaviourOpts
must be a list of locus_database:opt()
valuesok
in case of success.{error, invalid_url}
if the source is invalid.{error, already_started}
if the loader under DatabaseId
has already been started.See also: await_loader/1, await_loader/2, start_loader/1, start_loader/2.
stop_loader(DatabaseId) -> ok | {error, Error}
Stops the database loader under id DatabaseId
.
DatabaseId
must be an atom and refer to a database loader.ok
in case of success, {error, not_found}
otherwise.
Generated by EDoc