SaltDns. Rfc2136. Zone
(Salt v1.0.0)
An in-memory snapshot of one zone, the input of SaltDns.Rfc2136.Update
and SaltDns.Rfc2136.Query.
rrsets maps {owner_name, type} to {ttl, [rdata]}:
owner_nameis the canonical name: labels lower-cased and re-escaped by:dns_domain.join/1, no trailing dot.typeis the numeric RR type (SaltDns.Rfc2136.Rec).rdataaredns_erlangrdata structs made canonical on the way in (normalize_rdata/1lower-cases every domain-name field), kept sorted and unique, so RRsets compare as sets and TTL is ignored when comparing (RFC 2136 section 3.2.3).
Names are always compared label by label with :dns_domain.split/1, never
by string suffix, so x\.example.com (one label containing a dot) is not
inside example.com.
Summary
Functions
Applies a change list as Update.process/3 returns it: removes first, then
adds; an add sets the RRset's TTL. Used by tests and by callers that keep a
snapshot current.
Removes an RRset.
Builds a snapshot from #dns_rr{} records. Names must be inside the zone
(ArgumentError otherwise). Differing TTLs in one RRset are reduced to the
lowest (RFC 2181 section 5.2); duplicate rdata collapse.
True when some existing name is strictly below name (an empty non-terminal if name owns nothing).
True when labels is the zone apex or below it.
The lower-cased labels of name (unescaped, trailing dot ignored).
True when at least one RR is owned by name (empty non-terminals do not count).
An empty snapshot of the zone name.
Lower-cases every domain-name field of an rdata struct.
Like labels/1, but :error for a name dns_erlang cannot parse (for example an empty label).
Stores an RRset (rdata normalised, sorted, unique); an empty list deletes it.
All RRsets as #dns_rr{} records, sorted.
The {ttl, [rdata]} of an RRset, or nil. name must be canonical.
The apex SOA as {ttl, rdata}, or nil.
The upper-case mnemonic of a type number ("TYPE65280" when unknown).
The type number of a mnemonic produced by type_name/1.
The RR types present at name, sorted.
Types
@type change() :: {:add | :remove, String.t(), String.t(), non_neg_integer(), rdata()}
@type rdata() :: term()
@type rrset() :: {non_neg_integer(), [rdata()]}
@type t() :: %SaltDns.Rfc2136.Zone{ by_name: %{required(String.t()) => MapSet.t(non_neg_integer())}, labels: [binary()], name: String.t(), rrsets: %{required({String.t(), non_neg_integer()}) => rrset()} }
Functions
Applies a change list as Update.process/3 returns it: removes first, then
adds; an add sets the RRset's TTL. Used by tests and by callers that keep a
snapshot current.
@spec delete_rrset(t(), String.t(), non_neg_integer()) :: t()
Removes an RRset.
Builds a snapshot from #dns_rr{} records. Names must be inside the zone
(ArgumentError otherwise). Differing TTLs in one RRset are reduced to the
lowest (RFC 2181 section 5.2); duplicate rdata collapse.
True when some existing name is strictly below name (an empty non-terminal if name owns nothing).
True when labels is the zone apex or below it.
The lower-cased labels of name (unescaped, trailing dot ignored).
True when at least one RR is owned by name (empty non-terminals do not count).
An empty snapshot of the zone name.
Lower-cases every domain-name field of an rdata struct.
Like labels/1, but :error for a name dns_erlang cannot parse (for example an empty label).
@spec put_rrset(t(), String.t(), non_neg_integer(), rrset()) :: t()
Stores an RRset (rdata normalised, sorted, unique); an empty list deletes it.
All RRsets as #dns_rr{} records, sorted.
@spec rrset(t(), String.t(), non_neg_integer()) :: rrset() | nil
The {ttl, [rdata]} of an RRset, or nil. name must be canonical.
@spec soa(t()) :: {non_neg_integer(), rdata()} | nil
The apex SOA as {ttl, rdata}, or nil.
@spec type_name(non_neg_integer()) :: String.t()
The upper-case mnemonic of a type number ("TYPE65280" when unknown).
@spec type_number(String.t()) :: non_neg_integer()
The type number of a mnemonic produced by type_name/1.
@spec types_at(t(), String.t()) :: [non_neg_integer()]
The RR types present at name, sorted.