deletion

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 6 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 deletion is the deletion of a profile and of an account in the order of R21 (architecture 3.10): the database first, then the tuples of the rights, then the user at the sign-in service, and the account's row last. What does not finish after the database is done is the daily job's to finish (T28), and the caller answers "deleted" all the same.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deleter

type Deleter struct {
	// contains filtered or unexported fields
}

Deleter deletes on the database api, the rights and the sign-in service.

func New

func New(db store.Beginner, rights Rights, signin Signin) *Deleter

New is the deletion on db, rights and signin.

func (*Deleter) Account

func (d *Deleter) Account(ctx context.Context, accountID, uid string) error

Account deletes the account of the sign-in service's uid (R21; architecture 3.10). Step 1 is one transaction: the account's row FOR UPDATE, the mark "deleting", and all its data. When it fails, nothing is done, and the error is the caller's to answer. The rest — Finish — that does not finish is Unfinished: the mark stays, which tells the other devices the account is gone and which the job finishes.

func (*Deleter) Finish

func (d *Deleter) Finish(ctx context.Context, accountID, uid string) error

Finish does steps 2 to 4 of the deletion of a marked account (R21; architecture 3.10): the tuples of all its profiles, read by the account and deleted in batches; the user at the sign-in service — its refresh tokens revoked, then the user deleted, a user not there being done — which goes on when the tuples failed, since the sign-in service holds the person's identity and the tuples only IDs; and only when both are done, the account's row. A repeat redoes what is left; the job of T28 calls it for the marks the requests left.

func (*Deleter) IdleAccount added in v0.1.9

func (d *Deleter) IdleAccount(ctx context.Context, accountID, uid string, before time.Time) (bool, error)

IdleAccount deletes, as Account does and with no fresh sign-in, the account that had no request since before, and says whether it did: the daily job's deletion after 12 months (П-9). The term is read again under the row's lock, so that an owner who came back while the job chose the account keeps it.

func (*Deleter) IdleProfile added in v0.1.9

func (d *Deleter) IdleProfile(ctx context.Context, accountID, profileID string, before time.Time) (bool, error)

IdleProfile deletes, as Profile does and with no fresh sign-in, the account's profile that was not active since before, and says whether it did: the daily job's deletion after 12 months (П-9). The term is read again under the row's lock, so that a learner who came back while the job chose the profile keeps it.

func (*Deleter) Profile

func (d *Deleter) Profile(ctx context.Context, accountID, profileID string) error

Profile deletes the account's profile (R21; architecture 3.10): one transaction under the account, the account's row FOR KEY SHARE and the profile's FOR UPDATE, then its tuple. A profile that is not the account's is store.ErrNoProfile, a marked account store.ErrAccountDeleting; a tuple that does not go is Unfinished, dangling: no row is there for it to give a right to, and the job removes it.

type Rights

type Rights interface {
	DeleteOwner(ctx context.Context, accountID, profileID string) error
	DeleteOwned(ctx context.Context, accountID string, profileIDs []string) error
	OwnedProfiles(ctx context.Context, accountID string) ([]string, error)
}

Rights is what the deletion asks of the rights: authz.Rights.

type Signin

type Signin interface {
	RemoveUser(ctx context.Context, uid string) error
}

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

type Unfinished

type Unfinished struct {
	// contains filtered or unexported fields
}

Unfinished is a deletion whose database part is done and whose rest is not: a tuple left dangling, a user left at the sign-in service, the account's row. The caller answers "deleted": nothing of a learner is left in the database (R21).

func (*Unfinished) Error

func (u *Unfinished) Error() string

func (*Unfinished) Unwrap

func (u *Unfinished) Unwrap() error

Jump to

Keyboard shortcuts

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