SaltDns.Knot.EdgeCatalog (Salt v1.0.0)

The catalog zone that tells Salt DNS's own public edge which zones to serve: every active zone of every organisation.

Knot lets a zone be a member of only one catalog (verified: catalog-zone holds a single value, a second conf-set replaces the first), and each active zone is already a member of its organisation's catalog. So this catalog is not generated by Knot: Salt DNS writes it as an ordinary zone (RFC 9432: version TXT "2", one <id>.zones.<catalog> PTR <zone>. per member) and the edge consumes it with catalog-role: interpret. The edge's configuration is static; new organisations and zones need no edge change.

Refreshes are triggered by zone creation, update (status) and deletion (SaltDns.Knot.Sync.attach/0), coalesced for delay ms, and by every periodic reconcile. The catalog's name is config :salt_dns, SaltDns.Knot.EdgeCatalog, zone: "edge.catalog.invalid".

Summary

Functions

Returns a specification to start this module under a supervisor.

The records the catalog should hold for zone_names: the version and one PTR per member. Pure.

The member id of a zone in the catalog: the first 40 hex digits of the SHA-256 of its name. RFC 9432 only asks for a label that is unique within the catalog; deriving it from the name keeps it stable across refreshes.

The changes that turn the catalog's actual records (as read from Knot) into desired/2: removals of members and anything else catalog-shaped that should not be there, then additions. The apex SOA and NS are Knot's and are left alone. Pure.

Refreshes the catalog soon (coalesced) and returns at once. A no-op when config :salt_dns, SaltDns.Knot.EdgeCatalog, auto: false (tests that use a fake Knot); refresh_sync/0 always runs.

Refreshes the catalog now and waits.

The catalog zone's name.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

desired(catalog, zone_names)

@spec desired(String.t(), [String.t()]) :: [SaltDns.Zones.Change.t()]

The records the catalog should hold for zone_names: the version and one PTR per member. Pure.

member_id(zone_name)

@spec member_id(String.t()) :: String.t()

The member id of a zone in the catalog: the first 40 hex digits of the SHA-256 of its name. RFC 9432 only asks for a label that is unique within the catalog; deriving it from the name keeps it stable across refreshes.

plan(catalog, desired, actual)

The changes that turn the catalog's actual records (as read from Knot) into desired/2: removals of members and anything else catalog-shaped that should not be there, then additions. The apex SOA and NS are Knot's and are left alone. Pure.

refresh()

@spec refresh() :: :ok

Refreshes the catalog soon (coalesced) and returns at once. A no-op when config :salt_dns, SaltDns.Knot.EdgeCatalog, auto: false (tests that use a fake Knot); refresh_sync/0 always runs.

refresh_sync()

@spec refresh_sync() :: :ok | {:error, term()}

Refreshes the catalog now and waits.

zone()

@spec zone() :: String.t()

The catalog zone's name.