Karta. Inbound. Directory
(Karta v1.0.0)
The routes in memory, for the mx listener: which addresses Karta
receives, answered without the database (a Karta.Cache whose loader
this module is).
The cache holds, for every verified domain with routes, its routes by
local part: %{"info" => %{id:, server_id:, endpoint_id:, mode:, plus_addressing:, dmarc_reject:, spam_mode:, spam_threshold:, fail_closed:}, "*" => ...}. Only routes whose domain is verified, and
belongs to the organisation of the route's server, are loaded.
Lookups (lookup/2) read ETS in the caller's process: the route of
the address itself; else, for name+tag@domain, the route name when it
allows plus addressing; else the domain's * route. Local parts are
compared in lower case, domains in their ASCII form.
Freshness. The cache loads when the node starts and every minute.
A change to a route reloads it at once on every node (changed/0
announces it through Karta.PubSub, Karta.Inbound.Refresher listens).
While the database is down the last load keeps answering; a node that
started without one answers nothing (:cold), and the mx listener asks
senders to try again later.
Summary
Functions
Reloads the routes on every node (after a change to a route).
The route of address in the cache cache: {:ok, route},
:no_route (the domain is routed, the address is not), :no_domain
(Karta does not receive mail for the domain) or :cold (nothing loaded
yet).
Types
@type route() :: %{ id: Ecto.UUID.t(), server_id: Ecto.UUID.t(), endpoint_id: Ecto.UUID.t() | nil, mode: :endpoint | :accept | :hold | :reject, plus_addressing: boolean(), dmarc_reject: boolean(), spam_mode: :mark | :hold | :reject, spam_threshold: float(), fail_closed: boolean() }
Functions
@spec changed() :: :ok
Reloads the routes on every node (after a change to a route).
The route of address in the cache cache: {:ok, route},
:no_route (the domain is routed, the address is not), :no_domain
(Karta does not receive mail for the domain) or :cold (nothing loaded
yet).
@spec topic() :: String.t()
The Karta.PubSub topic of changed/0.