plugin

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Overview

Package plugin is the package that defines the reporter plugin, and those strategies must implement ReporterPlugin interface, supporting both embedded plugin and external registered plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyReporterPlugin

type DummyReporterPlugin struct {
	*util.StopControl
}

func (DummyReporterPlugin) GetCache

func (DummyReporterPlugin) GetReportContent

func (DummyReporterPlugin) ListAndWatchReportContentCallback

func (_ DummyReporterPlugin) ListAndWatchReportContentCallback(s string, response *v1alpha1.GetReportContentResponse)

func (DummyReporterPlugin) Name

func (_ DummyReporterPlugin) Name() string

func (DummyReporterPlugin) Run

func (_ DummyReporterPlugin) Run(success chan<- bool)

type Endpoint

type Endpoint interface {
	// Run initializes a ListAndWatch steam which will send a signal to the success channel
	// when it initializes successfully
	Run(success chan<- bool)
	// Stop will be call when this Endpoint was de-registered or some error happened in ListAndWatch
	Stop()
	// GetReportContent will call rpc GetReportContent to plugin directly
	GetReportContent(c context.Context) (*v1alpha1.GetReportContentResponse, error)
	// ListAndWatchReportContentCallback will be call when this Endpoint receives plugin ListAndWatch send
	ListAndWatchReportContentCallback(string, *v1alpha1.GetReportContentResponse)
	// GetCache get response cache of this Endpoint
	GetCache() *v1alpha1.GetReportContentResponse
	// IsStopped check this Endpoint whether be called stop function before
	IsStopped() bool
	// StopGracePeriodExpired check if this Endpoint has been stopped and exceeded the
	// grace period since the stop timestamp
	StopGracePeriodExpired() bool
}

Endpoint represents a single registered plugin. It is responsible for managing gRPC communications with the reporter plugin and caching reporter states.

func NewRemoteEndpoint

func NewRemoteEndpoint(socketPath, pluginName string, emitter metrics.MetricEmitter, callback ListAndWatchCallback) (Endpoint, error)

NewRemoteEndpoint creates a new Endpoint for the given reporter' plugin name. This is to be used during normal reporter' plugin registration.

func NewStoppedRemoteEndpoint

func NewStoppedRemoteEndpoint(pluginName string, cache *v1alpha1.GetReportContentResponse) Endpoint

NewStoppedRemoteEndpoint creates a new Endpoint for the given pluginName with stopTime set. This is to be used during Agent restart, before the actual reporter plugin re-registers.

type ListAndWatchCallback

type ListAndWatchCallback func(string, *v1alpha1.GetReportContentResponse)

ListAndWatchCallback should be called when plugins report info update.

type ReporterPlugin

type ReporterPlugin interface {
	Name() string
	Endpoint
}

ReporterPlugin performs report actions based on system or kubelet information.

Jump to

Keyboard shortcuts

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