controller

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package controller contains implementation to connect to the control plane. Including starting the ClientConn, starting the xDS stream, and sending/receiving messages.

All the messages are parsed by the resource package (e.g. UnmarshalListener()) and sent to the Pubsub watchers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller manages the connection and stream to the control plane.

It keeps track of what resources are being watched, and send new requests when new watches are added.

It takes a pubsub (as an interface) as input. When a response is received, it's parsed, and the updates are sent to the pubsub.

func New

func New(config *bootstrap.ServerConfig, updateHandler pubsub.UpdateHandler, validator resource.UpdateValidatorFunc, logger dubboLogger.Logger) (_ *Controller, retErr error)

New creates a new controller.

func (*Controller) AddWatch

func (t *Controller) AddWatch(rType resource.ResourceType, resourceName string)

AddWatch adds a watch for an xDS resource given its type and name.

func (*Controller) Close

func (t *Controller) Close()

Close closes the controller.

func (*Controller) RemoveWatch

func (t *Controller) RemoveWatch(rType resource.ResourceType, resourceName string)

RemoveWatch cancels an already registered watch for an xDS resource given its type and name.

func (*Controller) ReportLoad

func (c *Controller) ReportLoad(server string) (*load.Store, func())

ReportLoad starts an load reporting stream to the given server. If the server is not an empty string, and is different from the management server, a new ClientConn will be created.

The same options used for creating the Client will be used (including NodeProto, and dial options if necessary).

It returns a Store for the user to report loads, a function to cancel the load reporting stream.

TODO: LRS refactor; maybe a new controller should be created for a separate server, so that the same stream can be shared by different reporters to the same server, even if they originate from different Controllers.

func (*Controller) SetMetadata

func (t *Controller) SetMetadata(m *_struct.Struct) error

Directories

Path Synopsis
Package version defines APIs to deal with different versions of xDS.
Package version defines APIs to deal with different versions of xDS.
v2
Package v2 provides xDS v2 transport protocol specific functionality.
Package v2 provides xDS v2 transport protocol specific functionality.
v3
Package v3 provides xDS v3 transport protocol specific functionality.
Package v3 provides xDS v3 transport protocol specific functionality.

Jump to

Keyboard shortcuts

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