cluster

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTrackingListener

func NewTrackingListener(ctx context.Context, l net.Listener, m *DownstreamManager, source string) (net.Listener, error)

NewTrackingListener returns a listener which adds all connections made through it to the provided DownstreamManager. The net.Conn returned by Accept is only tracked if it is a *tls.Conn and was created by the nodeenrollment library. The source string is provided to add context to logs output by the NewTrackingListener.

Types

type DownstreamManager

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

DownstreamManager associates downstream worker key identifiers with the connections to a specific server. It is safe to access DownstreamManager concurrently.

func NewDownstreamManager

func NewDownstreamManager() *DownstreamManager

func (*DownstreamManager) Connected

func (m *DownstreamManager) Connected() *connectedState

Connected returns a connected state which provides the worker ids that are being tracked and any key ids for which we don't know the worker id.

type WorkerConnectionInfo added in v0.12.1

type WorkerConnectionInfo struct {
	// The address that the dialing worker is dialing
	UpstreamAddress string `mapstructure:"upstream_address,omitempty"`
	// The worker id of the worker that is dialing
	WorkerId string `mapstructure:"worker_id,omitempty"`
	// The version of the worker that is dialing
	BoundaryVersion string `mapstructure:"boundary_version,omitempty"`
	// The name, used for wrapping registration flow
	Name string `mapstructure:"name,omitempty"`
	// The description, used for wrapping registration flow
	Description string `mapstructure:"description,omitempty"`
	// The public address, used for wrapping registration flow
	PublicAddr string `mapstructure:"public_addr,omitempty"`
	// The operational state, used for wrapping registration flow
	OperationalState string `mapstructure:"operational_state,omitempty"`
}

WorkerConnectionInfo contains information about a worker that gets attached to outgoing connections to an upstream worker or the controller through the state of a *protocol.Conn.

func GetWorkerInfoFromStateMap added in v0.12.1

func GetWorkerInfoFromStateMap(ctx context.Context, c net.Conn) (*WorkerConnectionInfo, error)

GetWorkerInfoFromStateMap returns the WorkerConnectionInfo for the provided connection if the connection is a stateProvider. If it is not a stateProvider or if the provided state is nil, an error is returned.

func (*WorkerConnectionInfo) AsConnectionStateStruct added in v0.12.1

func (w *WorkerConnectionInfo) AsConnectionStateStruct() (*structpb.Struct, error)

AsConnectionStateStruct builds a structPb in the format that is expected for workers to attach their state to a *protocol.Conn through the withState option.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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