histfloor

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 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 histfloor is the "history deleted before" floor: when a user deletes their history (all of it, or everything before a month), no later writer may bring that history back. Rivian still has the receipts and a catch-up still has the old samples, so without a floor the receipts syncer, the replay catch-up and the drive and charge writers would re-insert what the user just deleted.

The floor is one timestamp per user (users.history_deleted_before). It only ever rises. Writers that bring in data by itself, not because the user asked, drop any row that starts before it. A user's own import or restore is explicit and passes Bypass: it is the user choosing to put their data back. The floor is never shown or exported, and it goes with the account (it is a column of users).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Below

func Below(ctx context.Context, q Querier, uid uuid.UUID, t time.Time) (bool, error)

Below reports whether a row that starts at t is before uid's floor and so must be dropped.

func Bypass

func Bypass(ctx context.Context) context.Context

Bypass marks ctx as a user-started import or restore: the user is putting their own data back, so the floor does not apply.

func Get

func Get(ctx context.Context, q Querier, uid uuid.UUID) (time.Time, error)

Get returns uid's floor, the zero time when there is none (and for a bypassed ctx or a nil database). An error is returned, never swallowed: a writer that cannot read the floor must not write what the floor may forbid.

func Raise

func Raise(ctx context.Context, e Execer, uid uuid.UUID, t time.Time) error

Raise lifts uid's floor to t. It never lowers it. Call it BEFORE the deletes it protects: a writer that reads the floor after that point cannot re-insert what the deletes are about to remove.

Types

type Execer

type Execer interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

Execer is the slice of *sql.DB / *sql.Tx Raise needs.

type Querier

type Querier interface {
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

Querier is the slice of *sql.DB / *sql.Tx the floor needs.

Jump to

Keyboard shortcuts

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