Documentation
¶
Overview ¶
Package postgres persists platform configuration and installation facts.
Index ¶
- Variables
- func Migrate(ctx context.Context, db *sql.DB) error
- type Repository
- func (r *Repository) Apply(ctx context.Context, in e.Update) (e.Rule, error)
- func (r *Repository) CheckRuntime(ctx context.Context) error
- func (r *Repository) Cleanup(ctx context.Context, now time.Time) (int64, error)
- func (r *Repository) Effective(ctx context.Context, action, school string) (e.Rule, error)
- func (r *Repository) Initialize(ctx context.Context, names []string) error
- func (r *Repository) ObserveInstalled(ctx context.Context, names []string) error
- func (r *Repository) Ready(ctx context.Context) error
- func (r *Repository) Reset(ctx context.Context, in e.ResetUpdate) (e.Rule, error)
- func (r *Repository) RetentionStatus(ctx context.Context, now time.Time) (RetentionStatus, error)
- func (r *Repository) SchoolRules(ctx context.Context, school string) (e.Configuration, error)
- func (r *Repository) State(ctx context.Context, name string) (h.State, error)
- func (r *Repository) View(ctx context.Context, fn func(a.Store) error) error
- func (r *Repository) Write(ctx context.Context, fn func(a.Store) error) error
- type RetentionCleaner
- type RetentionReport
- type RetentionStatus
- type TableRetention
Constants ¶
This section is empty.
Variables ¶
var Schema string
Functions ¶
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) CheckRuntime ¶
func (r *Repository) CheckRuntime(ctx context.Context) error
func (*Repository) Cleanup ¶
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) 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)
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)
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