server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentCleanupInterval is the default agent cleanup interval.
	AgentCleanupInterval = time.Minute
	// AgentCleanupTTL is the default agent cleanup time to live.
	AgentCleanupTTL = 15 * time.Minute
	// AgentHeartbeatInterval is the default interval for the heartbeat sent to the agent to keep the websocket live.
	AgentHeartbeatInterval = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentUpdates

type AgentUpdates struct {
	// Labels changes are only supported by OpAMP
	Labels *model.Labels

	// Configuration changes are only supported by OpAMP
	Configuration *model.Configuration

	// Version instructs the agent to install a specific version
	Version string
}

AgentUpdates contains fields that can be modified on an Agent and should be sent to the agent. The model.Agent should not be updated directly and will be updated when the agent reports its new status after the update is complete.

func (*AgentUpdates) Empty

func (u *AgentUpdates) Empty() bool

Empty returns true if the updates are empty because no changes need to be made to the agent

type BindPlane

type BindPlane interface {
	// Store TODO(doc)
	Store() store.Store
	// Manager TODO(doc)
	Manager() Manager
	// Versions TODO(doc)
	Versions() agent.Versions
	// Config TODO(doc)
	Config() *common.Server
	// Logger TODO(doc)
	Logger() *zap.Logger
}

BindPlane TODO(doc)

func NewBindPlane

func NewBindPlane(config *common.Server, logger *zap.Logger, s store.Store, versions agent.Versions) (BindPlane, error)

NewBindPlane TODO(doc)

type Manager

type Manager interface {
	// Start starts the manager and allows it to begin processing configuration changes
	Start(ctx context.Context)
	// EnableProtocol adds the protocol to the manager
	EnableProtocol(Protocol)
	// Agent returns the agent with the specified agentID.
	Agent(ctx context.Context, agentID string) (*model.Agent, error)
	// UpsertAgent adds a new Agent to the Store or updates an existing one
	UpsertAgent(ctx context.Context, agentID string, updater store.AgentUpdater) (*model.Agent, error)
	// AgentUpdates returns the updates that should be applied to an agent based on the current bindplane configuration
	AgentUpdates(ctx context.Context, agent *model.Agent) (*AgentUpdates, error)
	// VerifySecretKey checks to see if the specified secretKey matches configured secretKey
	VerifySecretKey(ctx context.Context, secretKey string) bool
	// ResourceStore provides access to the store to render configurations
	ResourceStore() model.ResourceStore
	// AgentVersion returns information about a version of an agent
	AgentVersion(ctx context.Context, version string) (*model.AgentVersion, error)
}

Manager manages agent connects and communications with them

func NewManager

func NewManager(config *common.Server, store store.Store, versions agent.Versions, logger *zap.Logger) (Manager, error)

NewManager returns a new implementation of the Manager interface

type Protocol

type Protocol interface {
	// Name is the name for the protocol use mostly for logging
	Name() string

	// Connected returns true if the specified agent ID is connected
	Connected(agentID string) bool

	// ConnectedAgents should return a slice of the currently connected agent IDs
	ConnectedAgentIDs(context.Context) ([]string, error)

	// Disconnect closes the any connection to the specified agent ID
	Disconnect(agentID string) bool

	// UpdateAgent should send a message to the specified agent to apply the updates
	UpdateAgent(context.Context, *model.Agent, *AgentUpdates) error

	// SendHeartbeat sends a heartbeat to the agent to keep the websocket open
	SendHeartbeat(agentID string) error
}

Protocol represents a communication protocol for managing agents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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