SaltDns.Zones.Diff (Salt v1.0.0)

The minimal list of record changes between two sets of rrsets.

Both sides use the rrset shape of SaltDns.Zones.Validate. Only served data counts: disabled records, and rrsets with no enabled record, are treated as absent.

diff/2 returns all removals first and then all additions, each group sorted by {name, type, rdata}. A TTL change is a removal of every old record followed by an addition of every new one, because the TTL belongs to the rrset and DNS has no operation to change it in place.

Summary

Functions

Applies changes (removals, then additions as given) to served data.

The changes that turn old into new.

The served data of a list of rrsets, keyed by {name, type}.

Types

rrset()

@type rrset() :: SaltDns.Zones.Validate.rrset()

served()

@type served() :: %{
  required({String.t(), String.t()}) => {pos_integer(), [String.t()]}
}

Functions

apply_changes(served, changes)

@spec apply_changes(served(), [SaltDns.Zones.Change.t()]) :: served()

Applies changes (removals, then additions as given) to served data.

This is the reference semantics of a change list; the property tests use it to show that apply_changes(served(a), diff(a, b)) == served(b).

diff(old, new)

@spec diff([rrset()], [rrset()]) :: [SaltDns.Zones.Change.t()]

The changes that turn old into new.

served(rrsets)

@spec served([rrset()]) :: served()

The served data of a list of rrsets, keyed by {name, type}.