Package txndefer implements a filter that calls best-effort callbacks on successful transaction commits.
Useful when an activity inside a transaction has some best-effort follow up that should be done once the transaction has successfully landed.
Defer schedules `cb` for execution when the current transaction successfully lands.
Intended for a best-effort non-transactional follow up to a successful transaction. Note that in presence of failures there's no guarantee the callback will be called. For example, the callback won't ever be called if the process crashes right after landing the transaction. Or if the transaction really landed, but RunInTransaction finished with "deadline exceeded" (or some similar) error.
Callbacks are executed sequentially in the reverse order they were deferred. They receive the non-transactional version of the context initially passed to RunInTransaction so that they inherit the deadline of the entire transaction.
Panics if the given context is not transactional or there's no txndefer filter installed.