View Source erldns_zone_cache (erldns v4.2.0)
A cache holding all of the zone data.
Write operations occur through the cache process mailbox, whereas read operations may occur either through the mailbox or directly through the underlying data store, depending on performance requirements.
Summary
Functions
Remove a zone from the cache without waiting for a response.
Remove zone RRSet
Find a zone for a given qname.
Find a zone for a given qname.
Find the SOA record for the given DNS question.
Get the list of NS and glue records for the given name. This function will always return a list, even if it is empty.
Return the record set for the given dname.
Get all records for the given type and given name.
Return current sync counter
Get a zone for the specific name. This function will not attempt to resolve the dname in any way, it will simply look up the name in the underlying data store.
Get all records for the given zone.
Get a zone for the specific name, including the records for the zone.
Check if the name is in a zone.
Initialize the zone cache.
Put a name and its records into the cache, along with a SHA which can be used to determine if the zone requires updating.
Put a zone into the cache and wait for a response.
Put zone RRSet
Check if the record name is in the zone. Will also return true if a wildcard is present at the node.
Start the zone cache process.
Given a zone name, list of records, and a digest, update the zone metadata in cache.
Return a list of tuples with each tuple as a name and the version SHA for the zone.
Functions
Remove a zone from the cache without waiting for a response.
Remove zone RRSet
-spec find_zone(dns:dname()) -> #zone{name :: dns:dname(), version :: binary(), authority :: [dns:rr()], record_count :: non_neg_integer(), records :: [dns:rr()] | trimmed, records_by_name :: #{binary() => [dns:rr()]} | trimmed, records_by_type :: term(), keysets :: [erldns:keyset()]} | {error, zone_not_found} | {error, not_authoritative}.
Find a zone for a given qname.
-spec find_zone(dns:dname(), {error, any()} | {ok, dns:rr()} | [dns:rr()] | dns:rr()) -> #zone{name :: dns:dname(), version :: binary(), authority :: [dns:rr()], record_count :: non_neg_integer(), records :: [dns:rr()] | trimmed, records_by_name :: #{binary() => [dns:rr()]} | trimmed, records_by_type :: term(), keysets :: [erldns:keyset()]} | {error, zone_not_found} | {error, not_authoritative}.
Find a zone for a given qname.
-spec get_authority(dns:message() | dns:dname()) -> {error, no_question} | {error, authority_not_found} | {ok, dns:authority()}.
Find the SOA record for the given DNS question.
Get the list of NS and glue records for the given name. This function will always return a list, even if it is empty.
Return the record set for the given dname.
Get all records for the given type and given name.
Return current sync counter
-spec get_zone(dns:dname()) -> {ok, #zone{name :: dns:dname(), version :: binary(), authority :: [dns:rr()], record_count :: non_neg_integer(), records :: [dns:rr()] | trimmed, records_by_name :: #{binary() => [dns:rr()]} | trimmed, records_by_type :: term(), keysets :: [erldns:keyset()]}} | {error, zone_not_found}.
Get a zone for the specific name. This function will not attempt to resolve the dname in any way, it will simply look up the name in the underlying data store.
Get all records for the given zone.
-spec get_zone_with_records(dns:dname()) -> {ok, #zone{name :: dns:dname(), version :: binary(), authority :: [dns:rr()], record_count :: non_neg_integer(), records :: [dns:rr()] | trimmed, records_by_name :: #{binary() => [dns:rr()]} | trimmed, records_by_type :: term(), keysets :: [erldns:keyset()]}} | {error, zone_not_found}.
Get a zone for the specific name, including the records for the zone.
Check if the name is in a zone.
Initialize the zone cache.
-spec put_zone({Name, Sha, Records, Keys} | {Name, Sha, Records}) -> ok | {error, Reason :: term()} when Name :: binary(), Sha :: binary(), Records :: [dns:rr()], Keys :: [erldns:keyset()].
Put a name and its records into the cache, along with a SHA which can be used to determine if the zone requires updating.
This function will build the necessary Zone record before inserting.
-spec put_zone(dns:name(), erldns:zone()) -> ok | {error, Reason :: term()}.
Put a zone into the cache and wait for a response.
-spec put_zone_rrset({dns:dname(), binary(), [dns:rr()]} | {dns:dname(), binary(), [dns:rr()], [any()]}, dns:dname(), dns:type(), integer()) -> ok | {error, Reason :: term()}.
Put zone RRSet
Check if the record name is in the zone. Will also return true if a wildcard is present at the node.
-spec start_link() -> any().
Start the zone cache process.
-spec update_zone_records_and_digest(dns:dname(), integer(), binary()) -> ok | {error, Reason :: term()}.
Given a zone name, list of records, and a digest, update the zone metadata in cache.
Return a list of tuples with each tuple as a name and the version SHA for the zone.