indicator_plugin

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPluginInitializers

func GetPluginInitializers() map[string]InitFunc

GetPluginInitializers returns initialized functions of indicator plugins

func RegisterPluginInitializer

func RegisterPluginInitializer(name string, initFunc InitFunc)

RegisterPluginInitializer is used to register user-defined indicator plugins

Types

type DummyIndicatorPlugin

type DummyIndicatorPlugin struct {
	SystemSpecNames     []apiworkload.ServiceSystemIndicatorName
	BusinessSpecNames   []apiworkload.ServiceBusinessIndicatorName
	BusinessStatusNames []apiworkload.ServiceBusinessIndicatorName
	ExtendedSpecNames   []string
}

func (DummyIndicatorPlugin) GetSupportedBusinessIndicatorSpec

func (d DummyIndicatorPlugin) GetSupportedBusinessIndicatorSpec() []apiworkload.ServiceBusinessIndicatorName

func (DummyIndicatorPlugin) GetSupportedBusinessIndicatorStatus

func (d DummyIndicatorPlugin) GetSupportedBusinessIndicatorStatus() []apiworkload.ServiceBusinessIndicatorName

func (DummyIndicatorPlugin) GetSupportedExtendedIndicatorSpec added in v0.4.1

func (d DummyIndicatorPlugin) GetSupportedExtendedIndicatorSpec() []string

func (DummyIndicatorPlugin) GetSupportedSystemIndicatorSpec

func (d DummyIndicatorPlugin) GetSupportedSystemIndicatorSpec() []apiworkload.ServiceSystemIndicatorName

func (DummyIndicatorPlugin) Name

func (d DummyIndicatorPlugin) Name() string

func (DummyIndicatorPlugin) Run

func (d DummyIndicatorPlugin) Run()

type IndicatorGetter

type IndicatorGetter interface {
	// GetIndicatorSpecChan + GetIndicatorStatusChan
	// returns a channel to obtain the whether an update action has been triggered.
	GetIndicatorSpecChan() chan types.NamespacedName
	GetIndicatorStatusChan() chan types.NamespacedName

	// GetIndicatorSpec + GetIndicatorStatus
	// for indicator get functions, IndicatorUpdater will return a channel to obtain the merged results.
	GetIndicatorSpec(_ types.NamespacedName) *apiworkload.ServiceProfileDescriptorSpec
	GetIndicatorStatus(_ types.NamespacedName) *apiworkload.ServiceProfileDescriptorStatus
}

IndicatorGetter is used by spd controller as indicator notifier to trigger update real spd.

type IndicatorManager

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

func NewIndicatorManager

func NewIndicatorManager() *IndicatorManager

func (*IndicatorManager) GetIndicatorSpec

func (*IndicatorManager) GetIndicatorSpecChan

func (u *IndicatorManager) GetIndicatorSpecChan() chan types.NamespacedName

func (*IndicatorManager) GetIndicatorStatus

func (*IndicatorManager) GetIndicatorStatusChan

func (u *IndicatorManager) GetIndicatorStatusChan() chan types.NamespacedName

func (*IndicatorManager) UpdateBusinessIndicatorSpec added in v0.4.0

func (u *IndicatorManager) UpdateBusinessIndicatorSpec(nn types.NamespacedName, indicators []apiworkload.ServiceBusinessIndicatorSpec)

func (*IndicatorManager) UpdateBusinessIndicatorStatus added in v0.4.0

func (u *IndicatorManager) UpdateBusinessIndicatorStatus(nn types.NamespacedName, indicators []apiworkload.ServiceBusinessIndicatorStatus)

func (*IndicatorManager) UpdateExtendedIndicatorSpec added in v0.4.1

func (u *IndicatorManager) UpdateExtendedIndicatorSpec(nn types.NamespacedName, indicators []apiworkload.ServiceExtendedIndicatorSpec)

func (*IndicatorManager) UpdateSystemIndicatorSpec added in v0.4.0

func (u *IndicatorManager) UpdateSystemIndicatorSpec(nn types.NamespacedName, indicators []apiworkload.ServiceSystemIndicatorSpec)

type IndicatorPlugin

type IndicatorPlugin interface {
	// Run starts the main loop for indicator plugin
	Run()
	Name() string

	// GetSupportedBusinessIndicatorSpec + GetSupportedSystemIndicatorSpec + GetSupportedBusinessIndicatorStatus
	// Those methods below returns the supported indicator names, if any name
	// is not supported by any indicator plugin, the controller will clear in CR.
	GetSupportedBusinessIndicatorSpec() []apiworkload.ServiceBusinessIndicatorName
	GetSupportedSystemIndicatorSpec() []apiworkload.ServiceSystemIndicatorName
	GetSupportedExtendedIndicatorSpec() []string
	GetSupportedBusinessIndicatorStatus() []apiworkload.ServiceBusinessIndicatorName
}

IndicatorPlugin represent an implementation for indicator sources; each plugin will implement its own indicator-obtain logic and use IndicatorUpdater to set the latest indicator info.

type IndicatorUpdater

type IndicatorUpdater interface {
	// UpdateExtendedIndicatorSpec + UpdateBusinessIndicatorSpec + UpdateSystemIndicatorSpec + UpdateBusinessIndicatorStatus
	// for indicator add functions, IndicatorUpdater will try to merge them in local stores.
	UpdateExtendedIndicatorSpec(_ types.NamespacedName, _ []apiworkload.ServiceExtendedIndicatorSpec)
	UpdateBusinessIndicatorSpec(_ types.NamespacedName, _ []apiworkload.ServiceBusinessIndicatorSpec)
	UpdateSystemIndicatorSpec(_ types.NamespacedName, _ []apiworkload.ServiceSystemIndicatorSpec)
	UpdateBusinessIndicatorStatus(_ types.NamespacedName, _ []apiworkload.ServiceBusinessIndicatorStatus)
}

IndicatorUpdater is used by IndicatorPlugin as a unified implementation to trigger indicator updating logic.

type InitFunc

type InitFunc func(ctx context.Context, conf *controller.SPDConfig, extraConf interface{},
	spdWorkloadInformer map[schema.GroupVersionResource]native.DynamicInformer,
	controlCtx *katalystbase.GenericContext, updater IndicatorUpdater) (IndicatorPlugin, error)

Jump to

Keyboard shortcuts

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