View Source locus_mmdb_tree (locus v2.3.7)

API for working with MMDB - tree section

Link to this section Summary

Functions

Looks up for a DataIndex for Address within Tree
Instantiates a new Tree out of TreeData, a few metadata properties and DataSectionSize

Link to this section Types

Specs

bad_tree_error() ::
    {invalid_node_index_for_ipv4_root, map()} | {ipv4_root_data_index_out_of_range, map()}.

Specs

index() :: non_neg_integer().

Specs

ip4_address_prefix() :: {inet:ip4_address(), 0..32}.

Specs

ip6_address_prefix() :: {inet:ip6_address(), 0..128}.

Specs

ip_address_prefix() :: ip4_address_prefix() | ip6_address_prefix().

Specs

t()

Link to this section Functions

Specs

lookup(Address, Tree) -> {ok, DataIndex} | not_found | {error, Reason}
          when
              Address :: inet:ip_address(),
              Tree :: t(),
              DataIndex :: locus_mmdb_data_codec:index(),
              Reason :: ipv4_database | not_found.
Looks up for a DataIndex for Address within Tree
Link to this function

new(TreeData, NodeCount, RecordSize, IpVersion, DataSectionSize)

View Source

Specs

new(TreeData, NodeCount, RecordSize, IpVersion, DataSectionSize) -> {ok, Tree} | {error, Reason}
       when
           TreeData :: binary(),
           NodeCount :: non_neg_integer(),
           RecordSize :: non_neg_integer(),
           IpVersion :: 4 | 6,
           DataSectionSize :: non_neg_integer(),
           Tree :: t(),
           Reason :: term().
Instantiates a new Tree out of TreeData, a few metadata properties and DataSectionSize
Link to this function

validate(Fun, WalkManager, Journal, Tree)

View Source

Specs

validate(fun((locus_mmdb_data_codec:index()) -> ok | {error, term()}),
         locus_mmdb_tree_walk_manager:handle(),
         locus_mmdb_check_journal:t(),
         t()) ->
            ok.