revisions

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	// RGDName is the logical ownership key. Revisions are grouped by name so a
	// re-created RGD can still reuse existing GraphRevisions.
	RGDName string
	// Revision is the monotonic revision number under RGDName.
	Revision int64
	// SpecHash is copied from GraphRevision spec and used by callers for
	// issuance decisions.
	SpecHash string
	// State is the runtime readiness signal for this entry.
	State RevisionState
	// CompiledGraph is populated for active revisions.
	// Registry writes enforce that Active never exists without a graph.
	CompiledGraph *graph.Graph
}

Entry is a single cached revision record for an RGD name.

type Registry

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

Registry is an in-memory cache shared by reconcilers.

The API server remains the source of truth. This cache exists to avoid recompiling graphs and to coordinate revision readiness between controllers.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty registry for compiled graph revisions.

func (*Registry) Delete

func (r *Registry) Delete(rgdName string, revision int64)

Delete removes one revision entry for rgdName.

The method is idempotent and safe to call for absent buckets/revisions.

func (*Registry) DeleteAll

func (r *Registry) DeleteAll(rgdName string)

DeleteAll removes every revision entry for rgdName.

This is used during RGD deletion to eagerly evict all cached revisions so that a recreated RGD with the same name cannot resolve stale compiled graphs.

func (*Registry) DeleteRevisionsBefore

func (r *Registry) DeleteRevisionsBefore(rgdName string, minRevision int64)

DeleteRevisionsBefore removes all entries with revision strictly lower than minRevision.

This is used by retention GC to keep only recent revisions per RGD.

func (*Registry) Get

func (r *Registry) Get(rgdName string, revision int64) (Entry, bool)

Get returns the entry for a specific (RGDName, Revision) pair.

func (*Registry) HasAll

func (r *Registry) HasAll(rgdName string, revisions []int64) bool

HasAll returns true when all listed revision numbers are present for rgdName.

This is a membership check only. Callers handle entry state separately.

func (*Registry) Latest

func (r *Registry) Latest(rgdName string) (Entry, bool)

Latest returns the highest revision entry for rgdName.

It returns false when there is no bucket, no latest marker, or if bucket metadata points to a missing entry.

func (*Registry) Put

func (r *Registry) Put(entry Entry)

Put inserts or replaces a revision entry.

Behavior: - idempotent overwrite for the same (RGDName, Revision) - advances latest pointer only when a strictly newer revision is written

Contract: - Callers always provide explicit State

func (*Registry) ResolverForRGD

func (r *Registry) ResolverForRGD(rgdName string) rgdResolver

ResolverForRGD returns a resolver scoped to a single RGD name.

type RevisionState

type RevisionState string

RevisionState is the runtime status of a revision in the in-memory cache.

These values are internal scheduling signals between controllers. They are intentionally separate from GraphRevision API status, which is conditions-only.

const (
	// RevisionStatePending means the GraphRevision object exists but compilation
	// has not completed yet.
	RevisionStatePending RevisionState = "Pending"
	// RevisionStateActive means compilation succeeded and CompiledGraph is ready
	// for direct consumption by reconcilers.
	RevisionStateActive RevisionState = "Active"
	// RevisionStateFailed means compilation failed for this revision.
	RevisionStateFailed RevisionState = "Failed"
)

Jump to

Keyboard shortcuts

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