staleness

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: AGPL-3.0 Imports: 7 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 staleness holds the effective doc_type policy store. Read-time needs-verification is content/event-driven (the section flag), not age-based; this package no longer computes freshness from a clock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PolicyStore added in v1.2.0

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

PolicyStore holds the effective doc_type policy set behind an atomic snapshot, loaded once at boot and recomputed on admin write (no TTL, no per-request DB hit). config-invalidation reloads it on other replicas via Recompute.

func NewPolicyStore added in v1.2.0

func NewPolicyStore(db *gorm.DB) *PolicyStore

NewPolicyStore returns a store seeded with the resolved default policies, so an un-Loaded store still serves the seeded rules; call Load at boot to pick up admin-edited rows.

func NewPolicyStoreFromEffective added in v1.2.0

func NewPolicyStoreFromEffective(eff map[string]models.EffectivePolicy) *PolicyStore

NewPolicyStoreFromEffective serves a pre-resolved policy set directly, skipping the DB load — for in-process callers and tests that resolve policies themselves.

func (*PolicyStore) All added in v1.2.0

All returns a copy of the effective set keyed by doc_type.

func (*PolicyStore) DocTypesWhere added in v1.2.0

func (s *PolicyStore) DocTypesWhere(pred func(models.EffectivePolicy) bool) []string

DocTypesWhere returns the doc_types whose effective policy satisfies pred, as a sorted slice — the SQL-array inputs (default_search, cleanup_scan, lint) that replace the old compiled-in EpisodicDocTypes bindings.

func (*PolicyStore) EffectiveFor added in v1.2.0

func (s *PolicyStore) EffectiveFor(docType string) models.EffectivePolicy

EffectiveFor returns a doc_type's effective policy, falling back to the reference row for an unknown doc_type.

func (*PolicyStore) Load added in v1.2.0

func (s *PolicyStore) Load(ctx context.Context) error

Load reads every policy row, resolves NULL inheritance, validates the merged set, and swaps the snapshot. A validation failure returns an error (boot stops) and leaves the current snapshot untouched.

func (*PolicyStore) Recompute added in v1.2.0

func (s *PolicyStore) Recompute(ctx context.Context) error

Recompute reloads after an admin write; satisfies the config-invalidation ReloadFunc signature.

func (*PolicyStore) Rows added in v1.2.0

Rows returns the raw policy rows (for the admin read + merged validation).

func (*PolicyStore) Upsert added in v1.2.0

func (s *PolicyStore) Upsert(ctx context.Context, row models.DocTypePolicy) error

Upsert writes one policy row (insert or update by doc_type), firing the trigger.

Jump to

Keyboard shortcuts

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