postgres

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0 Imports: 22 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 postgres persists platform configuration and installation facts.

Index

Constants

This section is empty.

Variables

View Source
var Schema string

Functions

func Migrate

func Migrate(ctx context.Context, db *sql.DB) error

Types

type Repository

type Repository struct {
	DB       *sql.DB
	Logger   *slog.Logger
	Now      func() time.Time
	ReadyTTL time.Duration
	// contains filtered or unexported fields
}

func (*Repository) Apply

func (r *Repository) Apply(ctx context.Context, in e.Update) (e.Rule, error)

func (*Repository) CheckRuntime

func (r *Repository) CheckRuntime(ctx context.Context) error

func (*Repository) Cleanup

func (r *Repository) Cleanup(ctx context.Context, now time.Time) (int64, error)

Cleanup removes at most 400 expired records per call. Current configuration and installation facts have no count cap and are never removed by retention.

func (*Repository) Effective

func (r *Repository) Effective(ctx context.Context, action, school string) (e.Rule, error)

func (*Repository) Initialize

func (r *Repository) Initialize(ctx context.Context, names []string) error

Initialize records explicitly verified absence. Existing facts cannot be replaced; in particular an installed module can never become never-installed.

func (*Repository) ObserveInstalled

func (r *Repository) ObserveInstalled(ctx context.Context, names []string) error

func (*Repository) Ready

func (r *Repository) Ready(ctx context.Context) error

Ready coalesces concurrent probes and caches positive database readiness for a short bounded window (default 1s; set ReadyTTL < 0 to disable caching).

func (*Repository) Reset added in v0.2.1

func (r *Repository) Reset(ctx context.Context, in e.ResetUpdate) (e.Rule, error)

func (*Repository) RetentionStatus added in v0.2.1

func (r *Repository) RetentionStatus(ctx context.Context, now time.Time) (RetentionStatus, error)

RetentionStatus reports expired backlog counts and earliest expired timestamps across all four platform retention tables in a single consistent snapshot.

func (*Repository) SchoolRules added in v0.2.1

func (r *Repository) SchoolRules(ctx context.Context, school string) (e.Configuration, error)

func (*Repository) State

func (r *Repository) State(ctx context.Context, name string) (h.State, error)

func (*Repository) View

func (r *Repository) View(ctx context.Context, fn func(a.Store) error) error

func (*Repository) Write

func (r *Repository) Write(ctx context.Context, fn func(a.Store) error) error

type RetentionCleaner added in v0.2.1

type RetentionCleaner struct {
	Repo     *Repository
	Interval time.Duration
	Now      func() time.Time
	Observe  func(RetentionReport)
	// contains filtered or unexported fields
}

RetentionCleaner runs bounded periodic retention cleanup and backlog observation within an Fx lifecycle, draining any in-flight pass on shutdown.

func (*RetentionCleaner) RegisterLifecycle added in v0.2.1

func (c *RetentionCleaner) RegisterLifecycle(lc fx.Lifecycle)

func (*RetentionCleaner) Start added in v0.2.1

func (c *RetentionCleaner) Start(_ context.Context) error

func (*RetentionCleaner) Stop added in v0.2.1

func (c *RetentionCleaner) Stop(ctx context.Context) error

type RetentionReport added in v0.2.1

type RetentionReport struct {
	Deleted int64
	Status  RetentionStatus
	Err     error
}

type RetentionStatus added in v0.2.1

type RetentionStatus struct {
	EligibilityRequests TableRetention `json:"eligibility_requests"`
	AuditSnapshots      TableRetention `json:"audit_snapshots"`
	AdminRequests       TableRetention `json:"admin_requests"`
	Audit               TableRetention `json:"audit"`
}

func (RetentionStatus) TotalExpired added in v0.2.1

func (s RetentionStatus) TotalExpired() int64

type TableRetention added in v0.2.1

type TableRetention struct {
	ExpiredCount    int64      `json:"expired_count"`
	OldestExpiredAt *time.Time `json:"oldest_expired_at,omitempty"`
}

Jump to

Keyboard shortcuts

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