conflator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

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(conflationUnitsReadyQueue *ConflationReadyQueue,
	requireInitialDependencyChecks bool, statistics *statistics.Statistics,
) *ConflationManager

NewConflationManager creates a new instance of ConflationManager.

func (*ConflationManager) GetBundlesMetadata

func (cm *ConflationManager) GetBundlesMetadata() []bundle.BundleMetadata

GetBundlesMetadata provides collections of the CU's bundle transport-metadata.

func (*ConflationManager) Insert

func (cm *ConflationManager) Insert(bundle statusbundle.Bundle, metadata bundle.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 ConflationPriority

type ConflationPriority uint8

ConflationPriority sets processing priorities of bundles.

const (
	ManagedClustersPriority               ConflationPriority = iota
	ClustersPerPolicyPriority             ConflationPriority = iota
	CompleteComplianceStatusPriority      ConflationPriority = iota
	DeltaComplianceStatusPriority         ConflationPriority = iota
	MinimalComplianceStatusPriority       ConflationPriority = iota
	PlacementRulePriority                 ConflationPriority = iota
	PlacementPriority                     ConflationPriority = iota
	PlacementDecisionPriority             ConflationPriority = iota
	SubscriptionStatusPriority            ConflationPriority = iota
	SubscriptionReportPriority            ConflationPriority = iota
	ControlInfoPriority                   ConflationPriority = iota
	LocalPolicySpecPriority               ConflationPriority = iota
	LocalClustersPerPolicyPriority        ConflationPriority = iota
	LocalCompleteComplianceStatusPriority ConflationPriority = iota
	LocalPlacementRulesSpecPriority       ConflationPriority = iota
	HubClusterInfoStatusPriority          ConflationPriority = iota
	LocalPolicyStatusEventPriority        ConflationPriority = iota
)

priority list of conflation unit.

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 bundle.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

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).

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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