Documentation
¶
Overview ¶
Package snapshotgen publishes immutable runtime policy/rating generations.
Index ¶
- type ExecutableGeneration
- func (g *ExecutableGeneration) AddPendingProvider(providerID string)
- func (g *ExecutableGeneration) AddPendingWork(workID, providerID string) bool
- func (g *ExecutableGeneration) CanRemoveProvider(providerID string) bool
- func (g *ExecutableGeneration) ClearPendingProvider(providerID string)
- func (g *ExecutableGeneration) ClearPendingWork(workID string)
- func (g *ExecutableGeneration) EnforcementMaxActive() int
- func (g *ExecutableGeneration) EvidenceObjectID() string
- func (g *ExecutableGeneration) LiveRefs() int64
- func (g *ExecutableGeneration) PendingProviderIDs() []string
- func (g *ExecutableGeneration) PendingWorkCount() int
- func (g *ExecutableGeneration) Release()
- func (g *ExecutableGeneration) Retain()
- func (g *ExecutableGeneration) ValidateComplete() error
- type Publisher
- func (p *Publisher) AddPendingWork(generationID int64, workID, providerID string) bool
- func (p *Publisher) CanRemoveProvider(providerID string) bool
- func (p *Publisher) ClearPendingProvider(generationID int64, providerID string)
- func (p *Publisher) ClearPendingWork(generationID int64, workID string)
- func (p *Publisher) Current() *RuntimeGeneration
- func (p *Publisher) CurrentExecutable() *ExecutableGeneration
- func (p *Publisher) LookupExecutable(id int64) *ExecutableGeneration
- func (p *Publisher) MarkUnusable(state economics.SnapshotState, reason string) *RuntimeGeneration
- func (p *Publisher) Publish(gen RuntimeGeneration) *RuntimeGenerationdeprecated
- func (p *Publisher) PublishExecutable(gen *ExecutableGeneration) (*ExecutableGeneration, error)
- func (p *Publisher) PublishMetadata(gen RuntimeGeneration) *RuntimeGeneration
- func (p *Publisher) UnresolvedProviderIDs() []string
- type RuntimeGeneration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutableGeneration ¶
type ExecutableGeneration struct {
ID int64
Version string
SourceID string
PublishedAt time.Time
State economics.SnapshotState
Reason string
Usage economics.Snapshot[economics.PolicyRulesView]
Concurrency economics.Snapshot[economics.PolicyRulesView]
Rating economics.Snapshot[economics.RatingCatalogView]
RequestRegistrations []authority.RequestRegistration
AttemptRegistrations []authority.AttemptRegistration
ConcurrencyRegistration *authority.ConcurrencyRegistration
// RequestCoord/AttemptCoord are the concrete immutable evaluators for this
// generation. New admissions must use these when present (D10).
RequestCoord *authoritycoord.RequestCoordinator
AttemptCoord *authoritycoord.AttemptCoordinator
MaxActiveRequests int
// contains filtered or unexported fields
}
ExecutableGeneration is one immutable published set of evaluator objects used by admission and settlement (requirements 9.1–9.9; design D10).
func CompileExecutable ¶
func CompileExecutable(contrib runtimegen.GenerationContribution) (*ExecutableGeneration, error)
CompileExecutable builds an ExecutableGeneration from a validated contribution.
func (*ExecutableGeneration) AddPendingProvider ¶
func (g *ExecutableGeneration) AddPendingProvider(providerID string)
AddPendingProvider tracks pending terminal-work references to a provider ID. Prefer AddPendingWork for WorkID-keyed idempotent ownership (task 3.6).
func (*ExecutableGeneration) AddPendingWork ¶
func (g *ExecutableGeneration) AddPendingWork(workID, providerID string) bool
AddPendingWork registers idempotent pending ownership for one WorkID. Returns false when workID was already present (no refcount bump).
func (*ExecutableGeneration) CanRemoveProvider ¶
func (g *ExecutableGeneration) CanRemoveProvider(providerID string) bool
CanRemoveProvider reports whether providerID may be removed from configuration.
func (*ExecutableGeneration) ClearPendingProvider ¶
func (g *ExecutableGeneration) ClearPendingProvider(providerID string)
ClearPendingProvider decrements a pending provider reference.
func (*ExecutableGeneration) ClearPendingWork ¶
func (g *ExecutableGeneration) ClearPendingWork(workID string)
ClearPendingWork clears WorkID-keyed pending ownership exactly once.
func (*ExecutableGeneration) EnforcementMaxActive ¶
func (g *ExecutableGeneration) EnforcementMaxActive() int
EnforcementMaxActive returns the concurrency limit from the actual generation objects.
func (*ExecutableGeneration) EvidenceObjectID ¶
func (g *ExecutableGeneration) EvidenceObjectID() string
EvidenceObjectID identifies the executable object for version evidence (9.9).
func (*ExecutableGeneration) LiveRefs ¶
func (g *ExecutableGeneration) LiveRefs() int64
LiveRefs reports outstanding live request bindings.
func (*ExecutableGeneration) PendingProviderIDs ¶
func (g *ExecutableGeneration) PendingProviderIDs() []string
PendingProviderIDs returns provider IDs with outstanding pending work.
func (*ExecutableGeneration) PendingWorkCount ¶
func (g *ExecutableGeneration) PendingWorkCount() int
PendingWorkCount reports outstanding WorkID-keyed pending entries.
func (*ExecutableGeneration) Release ¶
func (g *ExecutableGeneration) Release()
Release decrements the live reference count.
func (*ExecutableGeneration) Retain ¶
func (g *ExecutableGeneration) Retain()
Retain increments the live reference count (requirement 9.8).
func (*ExecutableGeneration) ValidateComplete ¶
func (g *ExecutableGeneration) ValidateComplete() error
ValidateComplete rejects metadata-only generations that lack executable objects.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher atomically publishes immutable generations for request binding.
func NewPublisher ¶
func NewPublisher() *Publisher
NewPublisher returns an empty publisher (Current is nil until Publish).
func (*Publisher) AddPendingWork ¶
AddPendingWork registers WorkID-keyed pending ownership on the named generation.
func (*Publisher) CanRemoveProvider ¶
CanRemoveProvider reports whether providerID may be removed across retained generations.
func (*Publisher) ClearPendingProvider ¶
ClearPendingProvider clears a pending provider ref on the named generation.
func (*Publisher) ClearPendingWork ¶
ClearPendingWork clears WorkID-keyed pending ownership on the named generation.
func (*Publisher) Current ¶
func (p *Publisher) Current() *RuntimeGeneration
Current returns the active generation pointer, or nil when none published.
func (*Publisher) CurrentExecutable ¶
func (p *Publisher) CurrentExecutable() *ExecutableGeneration
CurrentExecutable returns the active executable generation, if any.
func (*Publisher) LookupExecutable ¶
func (p *Publisher) LookupExecutable(id int64) *ExecutableGeneration
LookupExecutable returns a retained generation by ID (in-flight / pending drain).
func (*Publisher) MarkUnusable ¶
func (p *Publisher) MarkUnusable(state economics.SnapshotState, reason string) *RuntimeGeneration
MarkUnusable updates readiness of the active generation without replacing snapshot Values with an unrelated version (requirements 11.3, 11.7). Unknown states are rejected and the prior generation is preserved.
func (*Publisher) Publish
deprecated
func (p *Publisher) Publish(gen RuntimeGeneration) *RuntimeGeneration
Publish stores gen as the active metadata compatibility view with a new monotonic ID. Callers must treat returned generations as immutable.
Deprecated: metadata-only publication is not an enforcement path (D10). Use PublishExecutable for admission/settlement evaluator objects, or PublishMetadata for additive source-fetch compatibility views (requirement 11.2).
func (*Publisher) PublishExecutable ¶
func (p *Publisher) PublishExecutable(gen *ExecutableGeneration) (*ExecutableGeneration, error)
PublishExecutable validates and publishes an executable generation. On validation failure the prior executable generation remains active (9.6).
func (*Publisher) PublishMetadata ¶
func (p *Publisher) PublishMetadata(gen RuntimeGeneration) *RuntimeGeneration
PublishMetadata stores gen as the active metadata compatibility view with a new monotonic ID (requirement 11.2). Callers must treat returned generations as immutable. Enforcement uses PublishExecutable (D10).
func (*Publisher) UnresolvedProviderIDs ¶
UnresolvedProviderIDs aggregates pending provider IDs across retained generations.
type RuntimeGeneration ¶
type RuntimeGeneration struct {
ID int64
PublishedAt time.Time
State economics.SnapshotState
Reason string
Usage economics.Snapshot[economics.PolicyRulesView]
Concurrency economics.Snapshot[economics.PolicyRulesView]
Rating economics.Snapshot[economics.RatingCatalogView]
}
RuntimeGeneration is one immutable published set of usage, concurrency, and rating snapshots (design: Publication). Metadata views remain for compatibility; enforcement uses ExecutableGeneration (D10).