Documentation
¶
Overview ¶
Package sweep is the daily job of the terms of keeping: it finishes the deletions the requests left unfinished and deletes what is kept past its term — accounts and profiles idle for 12 months, users of the sign-in service with no account for 30 days, dangling tuples, the minimal records of consents for children 5 years after the deletion, the counters of the quota a day after their day, and the records of keys and OpenFGA's changelog after a day — and closes what a learner abandoned: an attempt with no action for 7 days, and a lesson run with none for 30. Before them it closes "unchecked" the attempts and lesson runs on the packages the image no longer gives, which are the two steps of the job after a rollout too. A pass keeps no state for the next: each step chooses its work again by a query, so a pass cut short is taken up by the next one. Its log is counts alone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterJob ¶ added in v0.1.20
type AfterJob struct {
// contains filtered or unexported fields
}
AfterJob runs the passes of the job after a rollout.
func After ¶ added in v0.1.20
After is the job after a rollout on db: it closes "unchecked" the open attempts and lesson runs on the packages the image of set no longer gives — withdrawn, or out of the window — and writes the evidence the closed attempts owe. It needs neither the rights nor the sign-in service.
type Rights ¶
type Rights interface {
deletion.Rights
Tuples(ctx context.Context) iter.Seq2[authz.Owned, error]
DropChangelog(ctx context.Context, before time.Time) (int64, error)
}
Rights is what the job asks of the rights: authz.Rights.
type Step ¶
Step is what a step of a pass did: how many it did and failed, and whether it went to its end — not cut short by the pass's time, and its own queries done.
type Sweeper ¶
type Sweeper struct {
// contains filtered or unexported fields
}
Sweeper runs the passes of the daily job.
func New ¶
func New(db DB, set *packages.Set, m *model.Model, rights Rights, signin Signin, settle time.Duration, log *slog.Logger) *Sweeper
New is the daily job on db, rights and signin, with the packages of the image, whose attempts and lesson runs it closes once the image no longer gives them, and the learner model. settle is the longest a request may run: a mark or a tuple younger than that may be a request's still going, and the job leaves it.
func (*Sweeper) Run ¶
Run runs one pass at now, until ctx ends: the steps of logging.Steps in their order, so that the tuples and the changelog the deletions leave go in the same pass, and the attempts the image no longer gives close "unchecked" before the abandoned ones close "abandoned". A step that fails goes on to the next item, and the next step runs all the same; once ctx is done, every step left stops before its first item.