Documentation
¶
Index ¶
- Constants
- Variables
- func EnsureIndexes(ctx context.Context, mgr manager.Manager, regs []IndexRegistration) error
- func IsIndexRegistered(obj client.Object, field string) bool
- func LogRegisteredIndexes()
- func RequiredControllerIndexes() map[string][]string
- func SetupIndexers(ctx context.Context, mgr manager.Manager) error
- type IndexRegistration
Constants ¶
View Source
const ( // IndexSentinelNoDescription is used when an EngramTemplate has no description, // allowing explicit queries for templates without descriptions. IndexSentinelNoDescription = "no-description" // IndexSentinelNoVersion is used when an EngramTemplate has no version set. IndexSentinelNoVersion = "no-version" // StepRunPhaseField is the cache index key for StepRun status.phase lookups. StepRunPhaseField = "status.phase" )
Index sentinel values for special cases.
Variables ¶
View Source
var ( IndexEngramTemplateRef = IndexRegistration{ Object: &bubushv1alpha1.Engram{}, Field: contracts.IndexEngramTemplateRef, Extractor: extractEngramTemplateName, ErrMsg: "failed to index Engram " + contracts.IndexEngramTemplateRef, } IndexStepRunEngramRef = IndexRegistration{ Object: &runsv1alpha1.StepRun{}, Field: contracts.IndexStepRunEngramRef, Extractor: extractStepRunEngramRef, ErrMsg: "failed to index StepRun " + contracts.IndexStepRunEngramRef, } IndexStepRunStoryRunRef = IndexRegistration{ Object: &runsv1alpha1.StepRun{}, Field: contracts.IndexStepRunStoryRunRef, Extractor: extractStepRunStoryRunRef, ErrMsg: "failed to index StepRun " + contracts.IndexStepRunStoryRunRef, } IndexStepRunPhase = IndexRegistration{ Object: &runsv1alpha1.StepRun{}, Field: StepRunPhaseField, Extractor: extractStepRunPhase, ErrMsg: "failed to index StepRun " + StepRunPhaseField, } IndexStoryRunImpulseRef = IndexRegistration{ Object: &runsv1alpha1.StoryRun{}, Field: contracts.IndexStoryRunImpulseRef, Extractor: extractStoryRunImpulseRef, ErrMsg: "failed to index StoryRun " + contracts.IndexStoryRunImpulseRef, } IndexStoryRunStoryRefName = IndexRegistration{ Object: &runsv1alpha1.StoryRun{}, Field: contracts.IndexStoryRunStoryRefName, Extractor: extractStoryRunStoryRefName, ErrMsg: "failed to index StoryRun " + contracts.IndexStoryRunStoryRefName, } IndexStoryRunStoryRefKey = IndexRegistration{ Object: &runsv1alpha1.StoryRun{}, Field: contracts.IndexStoryRunStoryRefKey, Extractor: extractStoryRunStoryRefKey, ErrMsg: "failed to index StoryRun " + contracts.IndexStoryRunStoryRefKey, } IndexImpulseTemplateRef = IndexRegistration{ Object: &bubushv1alpha1.Impulse{}, Field: contracts.IndexImpulseTemplateRef, Extractor: extractImpulseTemplateName, ErrMsg: "failed to index Impulse " + contracts.IndexImpulseTemplateRef, } IndexImpulseStoryRef = IndexRegistration{ Object: &bubushv1alpha1.Impulse{}, Field: contracts.IndexImpulseStoryRef, Extractor: extractImpulseStoryRefName, ErrMsg: "failed to index Impulse " + contracts.IndexImpulseStoryRef, } IndexStoryStepEngramRefs = IndexRegistration{ Object: &bubushv1alpha1.Story{}, Field: contracts.IndexStoryStepEngramRefs, Extractor: extractStoryStepEngramRefs, ErrMsg: "failed to index Story " + contracts.IndexStoryStepEngramRefs, } IndexStoryStepStoryRefs = IndexRegistration{ Object: &bubushv1alpha1.Story{}, Field: contracts.IndexStoryStepStoryRefs, Extractor: extractStoryExecuteStoryRefs, ErrMsg: "failed to index Story " + contracts.IndexStoryStepStoryRefs, } IndexStoryTransportRefs = IndexRegistration{ Object: &bubushv1alpha1.Story{}, Field: contracts.IndexStoryTransportRefs, Extractor: extractStoryTransportRefs, ErrMsg: "failed to index Story " + contracts.IndexStoryTransportRefs, } IndexTransportBindingTransportRef = IndexRegistration{ Object: &transportv1alpha1.TransportBinding{}, Field: contracts.IndexTransportBindingTransportRef, Extractor: extractTransportBindingTransportRef, ErrMsg: "failed to index TransportBinding " + contracts.IndexTransportBindingTransportRef, } IndexEngramTemplateDescription = IndexRegistration{ Object: &catalogv1alpha1.EngramTemplate{}, Field: contracts.IndexEngramTemplateDescription, Extractor: extractEngramTemplateDescription, ErrMsg: "failed to index EngramTemplate " + contracts.IndexEngramTemplateDescription, } IndexEngramTemplateVersion = IndexRegistration{ Object: &catalogv1alpha1.EngramTemplate{}, Field: contracts.IndexEngramTemplateVersion, Extractor: extractEngramTemplateVersion, ErrMsg: "failed to index EngramTemplate " + contracts.IndexEngramTemplateVersion, } )
Functions ¶
func EnsureIndexes ¶ added in v0.1.4
EnsureIndexes registers each requested field index once per manager process.
func IsIndexRegistered ¶ added in v0.1.4
IsIndexRegistered checks if a field index was registered at startup.
Behavior:
- Returns true if the index was registered via EnsureIndexes.
- Can be used by controllers to verify index availability before relying on indexed lookups.
Arguments:
- obj client.Object: the object type the index applies to.
- field string: the field path for the index.
Returns:
- bool: true if registered, false otherwise.
func LogRegisteredIndexes ¶ added in v0.1.4
func LogRegisteredIndexes()
LogRegisteredIndexes emits a summary log of indexes that were actually registered in the current process. Only entries present in the registeredIndexes sync.Map (i.e. those that completed without error) are reported, so the log accurately reflects the live index state rather than the declared registration list.
Side Effects:
- Writes a log entry to the setup logger.
func RequiredControllerIndexes ¶ added in v0.1.4
RequiredControllerIndexes returns a map of controller names to their required indexes. This can be used for runtime verification or documentation.
Types ¶
Click to show internal directories.
Click to hide internal directories.