References
database() = #{metadata := locus_mmdb_metadata:t(), tree := locus_mmdb_tree:t(), data_section := binary()}
failed_to_unpack_tree_data_and_data_section() = {intermediate_128bits_of_zero_not_found_after_tree, {{not_zeroes, binary()}, {at_offset, non_neg_integer()}, {with_metadata, locus_mmdb_metadata:t()}}} | {missing_data_after_tree, {{required, {128, bits}}, {but_got, {0..127, bits}}, {at_offset, non_neg_integer()}, {with_metadata, locus_mmdb_metadata:t()}}} | {not_enough_data_for_tree, {{required, {pos_integer(), bytes}}, {but_got, {non_neg_integer(), bytes}}, {with_metadata, locus_mmdb_metadata:t()}}}
unpack_error() = {bad_metadata, locus_mmdb_metadata:parse_or_validation_error()} | failed_to_unpack_tree_data_and_data_section() | {bad_tree, {{because, locus_mmdb_tree:bad_tree_error()}, {with_metadata, locus_mmdb_metadata:t()}}}
| lookup_address/2 | Looks up for an entry matching Address within Database |
| unpack_database/1 | Unpacks an EncodedDatabase binary into a ready-to-use Database. |
| unpack_tree_data_and_data_section/2 | Unpacks a single TreeAndDataSection binary into
separate TreeData and DataSection binaries, leveraging
Metadata to calculate the size of TreeData. |
lookup_address(Address, Database) -> {ok, Entry} | not_found | {error, ErrorReason}
Looks up for an entry matching Address within Database
unpack_database(EncodedDatabase) -> {ok, Database} | {error, ErrorReason}
Unpacks an EncodedDatabase binary into a ready-to-use Database.
unpack_tree_data_and_data_section(Metadata, TreeAndDataSection) -> {ok, TreeData, DataSection} | {error, Reason}
Unpacks a single TreeAndDataSection binary into
separate TreeData and DataSection binaries, leveraging
Metadata to calculate the size of TreeData.
You can then use TreeData on your own or leverage it
to instantiate a new locus_mmdb_tree:t(),
through locus_mmdb_tree:new/5.
As for DataSection, you can also either use it on your own
or pass it to the API defined under locus_mmdb_data_codec.
Metadata and TreeAndDataSection
in the first place, see locus_mmdb_metadata:parse_and_validate/1.
Generated by EDoc