Documentation ¶
Index ¶
Constants ¶
const ( ManagedClustersPriority conflationPriority = iota // ManagedClusters = 0 ClustersPerPolicyPriority conflationPriority = iota // ClustersPerPolicy = 1 CompleteComplianceStatusPriority conflationPriority = iota // CompleteComplianceStatus = 2 DeltaComplianceStatusPriority conflationPriority = iota // DeltaComplianceStatus = 3 MinimalComplianceStatusPriority conflationPriority = iota // MinimalComplianceStatus = 4 ControlInfoPriority conflationPriority = iota // ControlInfo = 5 LocalPolicySpecPriority conflationPriority = iota // LocalPolicySpec = 6 LocalClustersPerPolicyPriority conflationPriority = iota // LocalClustersPerPolicy = 7 LocalCompleteComplianceStatusPriority conflationPriority = iota // LocalCompleteComplianceStatus = 8 LocalPlacementRulesSpecPriority conflationPriority = iota // LocalPlacementRulesSpec = 9 )
priority list of conflation unit.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BundleHandlerFunc ¶
BundleHandlerFunc is a function for handling a bundle.
type BundleMetadata ¶
type BundleMetadata struct {
// contains filtered or unexported fields
}
BundleMetadata abstracts metadata of conflation elements inside the conflation units.
type ConflationManager ¶
type ConflationManager struct {
// contains filtered or unexported fields
}
ConflationManager implements conflation units management.
func NewConflationManager ¶
func NewConflationManager(log logr.Logger, conflationUnitsReadyQueue *ConflationReadyQueue, requireInitialDependencyChecks bool, statistics *statistics.Statistics) *ConflationManager
NewConflationManager creates a new instance of ConflationManager.
func (*ConflationManager) GetBundlesMetadata ¶
func (cm *ConflationManager) GetBundlesMetadata() []transport.BundleMetadata
GetBundlesMetadata provides collections of the CU's bundle transport-metadata.
func (*ConflationManager) Insert ¶
func (cm *ConflationManager) Insert(bundle bundle.Bundle, metadata transport.BundleMetadata)
Insert function inserts the bundle to the appropriate conflation unit.
func (*ConflationManager) Register ¶
func (cm *ConflationManager) Register(registration *ConflationRegistration)
Register registers bundle type with priority and handler function within the conflation manager.
type ConflationReadyQueue ¶
type ConflationReadyQueue struct {
// contains filtered or unexported fields
}
ConflationReadyQueue is a queue of conflation units that have at least one bundle to process.
func NewConflationReadyQueue ¶
func NewConflationReadyQueue(statistics *statistics.Statistics) *ConflationReadyQueue
NewConflationReadyQueue creates a new instance of ConflationReadyQueue.
func (*ConflationReadyQueue) BlockingDequeue ¶
func (rq *ConflationReadyQueue) BlockingDequeue() *ConflationUnit
BlockingDequeue pops ConflationUnit from the beginning of the queue. if no CU is ready, this call is blocking.
func (*ConflationReadyQueue) Enqueue ¶
func (rq *ConflationReadyQueue) Enqueue(cu *ConflationUnit)
Enqueue inserts ConflationUnit to the end of the ready queue.
type ConflationRegistration ¶
type ConflationRegistration struct {
// contains filtered or unexported fields
}
ConflationRegistration is used to register a new conflated bundle type along with its priority and handler function.
func NewConflationRegistration ¶
func NewConflationRegistration(priority conflationPriority, syncMode status.BundleSyncMode, bundleType string, handlerFunction BundleHandlerFunc) *ConflationRegistration
NewConflationRegistration creates a new instance of ConflationRegistration.
func (*ConflationRegistration) WithDependency ¶
func (registration *ConflationRegistration) WithDependency(dependency *dependency.Dependency) *ConflationRegistration
WithDependency declares a dependency required by the given bundle type.
type ConflationUnit ¶
type ConflationUnit struct {
// contains filtered or unexported fields
}
ConflationUnit abstracts the conflation of prioritized multiple bundles with dependencies between them.
func (*ConflationUnit) GetNext ¶
func (cu *ConflationUnit) GetNext() (bundle.Bundle, *BundleMetadata, BundleHandlerFunc, error)
GetNext returns the next ready to be processed bundle and its transport metadata.
func (*ConflationUnit) ReportResult ¶
func (cu *ConflationUnit) ReportResult(metadata *BundleMetadata, err error)
ReportResult is used to report the result of bundle handling job.
type ResultReporter ¶
type ResultReporter interface {
ReportResult(metadata *BundleMetadata, err error)
}
ResultReporter is an interface used to report the result of the handler function after its invocation. the idea is to have a clear separation of concerns and make sure dispatcher can only request for bundles and DB workers can only report results and not request for additional bundles. this makes sure DB workers get their input only via the dispatcher which is the entity responsible for reading bundles and invoking the handler functions using DB jobs. (using this interfaces verifies no developer violates the design that was intended).