sweep

package
v0.1.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sweep is the daily job of the terms of keeping (R05, R21, R38, R43): 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 (R10, R13). 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 (R07). 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 (R07, R51).

func After added in v0.1.20

func After(db DB, set *packages.Set, m *model.Model, log *slog.Logger) *AfterJob

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 (R49). It needs neither the rights nor the sign-in service.

func (*AfterJob) Run added in v0.1.20

func (a *AfterJob) Run(ctx context.Context, now time.Time) Report

Run runs one pass of the job after a rollout at now, until ctx ends, as the daily job runs its own: the steps of logging.AfterSteps, a line for each.

type DB

type DB interface {
	store.Beginner
	store.Querier
	store.Lister
}

DB is the database api: a pool.

type Report

type Report []Step

Report is the steps of a pass, in their order.

func (Report) Clean

func (r Report) Clean() bool

Clean says whether the pass did all it had to: every step to its end, with no failure. A term that depends on the job runs to its next clean pass (R21).

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 Signin

type Signin interface {
	deletion.Signin
	Users(ctx context.Context) iter.Seq2[authn.User, error]
}

Signin is what the job asks of the sign-in service: authn.Port.

type Step

type Step struct {
	Name     string
	Done     int64
	Failed   int64
	Finished bool
}

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 (R07), 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

func (s *Sweeper) Run(ctx context.Context, now time.Time) Report

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" (R07). 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.

func (*Sweeper) WithForms added in v0.1.21

func (s *Sweeper) WithForms(store forms.Store) *Sweeper

WithForms is the job with the store of the scans of the forms of consent, whose scans past their term it erases (R116, R117 spec).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL