Documentation
¶
Overview ¶
Package trackinghostlog writes the change log behind the service read of Tracking domain hosts (ADR 0038). A Sending domain is a verified host while its tracking_state is dns_verified or serving and it is not archived (Serving, the one definition the host gate shares); each change of that (a host entering a state, or leaving both because its record stopped resolving, or its Sending domain was archived, deleted or renamed; an unarchive is an addition once the host is verified again) is one row of tracking_host_changes, so a removal is never silence.
Two ent hooks keep it so no write path can forget it, the same pair as internal/workspacefeed. Hook runs on every transaction client (the event bus's): the change and its log row commit together, in the order the positions were taken. Guard runs on the plain client (db.NewEntClient) and refuses a change to a host outside a transaction, where the log row would be a separate statement that a crash loses. The hook reads Sending domains of any Workspace to find the hosts a change touches, which is why this package is on the closed list of raw-client packages in AGENTS.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNeedsTransaction = errors.New("tracking host change outside a transaction")
ErrNeedsTransaction is what Guard returns for a change to a host made on a client that is not bound to a transaction.
Functions ¶
func Guard ¶
Guard is the ent hook for a client that is not bound to a transaction: it refuses every mutation that Hook would log. Such a change goes through the event bus's transaction (events.Bus.WithinTx).
func Hook ¶
Hook is the ent hook to install on a client bound to a transaction (Client.Use). It is a no-op for every mutation that cannot change what the log reports.
func Serving ¶
func Serving() predicate.SendingDomain
Serving selects the Sending domains that serve their Tracking host: a verified tracking state and not archived (ADR 0049). It is the query form of serves; the host gate and the recheck job use it, so there is one definition.
Types ¶
This section is empty.