lrs

package
v1.69.2 Latest Latest
Warning

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

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

Documentation

Overview

Package lrs provides the implementation of an LRS (Load Reporting Service) stream for the xDS client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StreamImpl

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

StreamImpl provides all the functionality associated with an LRS (Load Reporting Service) stream on the client-side. It manages the lifecycle of the LRS stream, including starting, stopping, and retrying the stream. It also provides a load.Store that can be used to report load, and a cleanup function that should be called when the load reporting is no longer needed.

func NewStreamImpl

func NewStreamImpl(opts StreamOpts) *StreamImpl

NewStreamImpl creates a new StreamImpl with the provided options.

The actual streaming RPC call is initiated when the first call to ReportLoad is made, and is terminated when the last call to ReportLoad is canceled.

func (*StreamImpl) ReportLoad

func (lrs *StreamImpl) ReportLoad() (*load.Store, func())

ReportLoad returns a load.Store that can be used to report load, and a cleanup function that should be called when the load reporting is no longer needed.

The first call to ReportLoad sets the reference count to one, and starts the LRS streaming call. Subsequent calls increment the reference count and return the same load.Store.

The cleanup function decrements the reference count and stops the LRS stream when the last reference is removed.

func (*StreamImpl) Stop

func (lrs *StreamImpl) Stop()

Stop blocks until the stream is closed and all spawned goroutines exit.

type StreamOpts

type StreamOpts struct {
	Transport transport.Transport     // xDS transport to create the stream on.
	Backoff   func(int) time.Duration // Backoff for retries, after stream failures.
	NodeProto *v3corepb.Node          // Node proto to identify the gRPC application.
	LogPrefix string                  // Prefix to be used for log messages.
}

StreamOpts holds the options for creating an lrsStream.

Jump to

Keyboard shortcuts

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