Documentation
¶
Overview ¶
Package embeddedbudget measures and enforces checked-in catalog budgets.
Index ¶
Constants ¶
View Source
const ( // DefaultMaxAge is the checked-in catalog freshness budget. DefaultMaxAge = 30 * 24 * time.Hour // DefaultMaxUncompressedBytes is the canonical payload size budget. DefaultMaxUncompressedBytes int64 = 16 << 20 // DefaultMaxCompressedBytes is the deterministic archive size budget. DefaultMaxCompressedBytes int64 = 8 << 20 // DefaultMinProviders is the minimum embedded provider coverage. DefaultMinProviders = 5 // DefaultMinModels is the minimum embedded canonical model coverage. DefaultMinModels = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limits ¶
type Limits struct {
MaxAge time.Duration `json:"-"`
MaxUncompressedBytes int64 `json:"max_uncompressed_bytes"`
MaxCompressedBytes int64 `json:"max_compressed_bytes"`
MinProviders int `json:"min_providers"`
MinModels int `json:"min_models"`
}
Limits are the reviewed age, size, and coverage thresholds.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns the checked-in production budget policy.
func (Limits) MarshalJSON ¶
MarshalJSON emits the age limit in seconds so CI reports have an explicit, language-independent unit rather than time.Duration nanoseconds.
type Report ¶
type Report struct {
GenerationID string `json:"generation_id"`
GeneratedAt time.Time `json:"generated_at"`
MeasuredAt time.Time `json:"measured_at"`
AgeSeconds int64 `json:"age_seconds"`
PayloadChecksum string `json:"payload_checksum"`
UncompressedBytes int64 `json:"uncompressed_bytes"`
CompressedBytes int64 `json:"compressed_bytes"`
ProviderCount int `json:"provider_count"`
ModelCount int `json:"model_count"`
Limits Limits `json:"limits"`
OverrideReason string `json:"override_reason,omitempty"`
Passed bool `json:"passed"`
Violations []Violation `json:"violations,omitempty"`
}
Report records exact embedded catalog measurements and applied limits.
func Check ¶
func Check(generation catalogstore.Generation, measuredAt time.Time, limits Limits, overrideReason string) (Report, error)
Check measures one validated generation and applies age, compressed and uncompressed size, provider, and model budgets.
Click to show internal directories.
Click to hide internal directories.