client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTP

func NewHTTP(logger types.Logger) *httpClient

func NewWebSocket

func NewWebSocket(logger types.Logger) *wsClient

Types

type OpAMPClient

type OpAMPClient interface {

	// Start the client and begin attempts to connect to the Server. Once connection
	// is established the client will attempt to maintain it by reconnecting if
	// the connection is lost. All failed connection attempts will be reported via
	// OnConnectFailed callback.
	//
	// AgentDescription in settings MUST be set.
	//
	// Start may immediately return an error if the settings are incorrect (e.g. the
	// serverURL is not a valid URL).
	//
	// Start does not wait until the connection to the Server is established and will
	// likely return before the connection attempts are even made.
	//
	// It is guaranteed that after the Start() call returns without error one of the
	// following callbacks will be called eventually (unless Stop() is called earlier):
	//  - OnConnectFailed
	//  - OnError
	//  - OnRemoteConfig
	//
	// Start should be called only once. It should not be called concurrently with
	// any other OpAMPClient methods.
	Start(ctx context.Context, settings types.StartSettings) error

	// Stop the client. May be called only after Start() returns successfully.
	// May be called only once.
	// After this call returns successfully it is guaranteed that no
	// callbacks will be called. Stop() will cancel context of any in-fly
	// callbacks, but will wait until such in-fly callbacks are returned before
	// Stop returns, so make sure the callbacks don't block infinitely and react
	// promptly to context cancellations.
	// Once stopped OpAMPClient cannot be started again.
	Stop(ctx context.Context) error

	// SetAgentDescription sets attributes of the Agent. The attributes will be included
	// in the next status report sent to the Server. MUST be called before Start().
	// May be also called after Start(), in which case the attributes will be included
	// in the next outgoing status report. This is typically used by Agents which allow
	// their AgentDescription to change dynamically while the OpAMPClient is started.
	// May be also called from OnMessage handler.
	//
	// The Hash field will be calculated and updated from the content of the rest of
	// the fields.
	//
	// nil values are not allowed and will return an error.
	SetAgentDescription(descr *protobufs.AgentDescription) error

	// AgentDescription returns the last value successfully set by SetAgentDescription().
	AgentDescription() *protobufs.AgentDescription

	// UpdateEffectiveConfig fetches the current local effective config using
	// GetEffectiveConfig callback and sends it to the Server.
	// May be called anytime after Start(), including from OnMessage handler.
	UpdateEffectiveConfig(ctx context.Context) error

	// SetRemoteConfigStatus sets the current RemoteConfigStatus.
	// LastRemoteConfigHash field must be non-nil.
	// May be called anytime after Start(), including from OnMessage handler.
	// nil values are not allowed and will return an error.
	SetRemoteConfigStatus(status *protobufs.RemoteConfigStatus) error

	// SetPackageStatuses sets the current PackageStatuses.
	// ServerProvidedAllPackagesHash must be non-nil.
	// May be called anytime after Start(), including from OnMessage handler.
	// nil values are not allowed and will return an error.
	SetPackageStatuses(statuses *protobufs.PackageStatuses) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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