feat: contract.Rebuilder asks for a debounced rebuild

The sitemap publishes classes.Listing as contract.Rebuilder too, so a
plugin whose Filter reads data of its own can queue the debounced rebuild
a record event queues when that data changes.
This commit is contained in:
Jakub Zych
2026-11-04 22:39:14 +01:00
parent 1048c01fd9
commit 6b67ab759b
5 changed files with 59 additions and 5 deletions

View File

@@ -79,6 +79,18 @@ type Filter interface {
Groups(ctx context.Context) ([]Group, error)
}
// Rebuilder asks the sitemap for a rebuild. RequestRebuild queues one
// debounced rebuild, the same one a record event queues: a request inside
// the debounce window joins the rebuild already queued. Another plugin
// calls it when something its Filter reads has changed (the SEO plugin's
// noindex paths). The sitemap plugin publishes it with
// app.Publish[contract.Rebuilder] in its Register; a plugin that finds none
// published (an older sitemap plugin) leaves the change to the next
// scheduled rebuild.
type Rebuilder interface {
RequestRebuild(ctx context.Context) error
}
// Listing is what the sitemap publishes for other plugins: its settings and
// the listed addresses of each group. The sitemap plugin publishes it with
// app.Publish[contract.Listing] in its Register.