agent

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPassPeriod              = yson.Duration(5 * time.Second)
	DefaultCollectOperationsPeriod = yson.Duration(time.Minute)
	DefaultRevisionCollectPeriod   = yson.Duration(5 * time.Second)
	DefaultPassWorkerNumber        = 1
)

Variables

This section is empty.

Functions

func CollectOperations added in v0.0.3

func CollectOperations(
	ctx context.Context,
	ytc yt.Client,
	period time.Duration,
	opNamespace string,
	l log.Logger) <-chan []yt.OperationStatus

func TrackChildren

func TrackChildren(ctx context.Context, root ypath.Path, period time.Duration, ytc yt.Client, l log.Logger) <-chan []ypath.Path

TrackChildren is a primitive for subscription on changes of Cypress nodes in the given subtree. It emits relative paths w.r.t. root of changed nodes.

At the beginning it notifies caller about all nodes in the subtree. After that, it performs lightweight "get with attributes" requests with given periodicity and tracks node revision change events including node disappearance events. Note that each pass which did not result in any event still produces an empty slice which allows building reliable logic assuming the absence of future modifications (see waitForPaths helper from tests for an example)

Current implementation does not descend into opaque nodes.

Types

type Agent

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

func NewAgent

func NewAgent(proxy string, ytc yt.Client, l log.Logger, controller strawberry.Controller, config *Config) *Agent

func (*Agent) GetAgentInfo

func (a *Agent) GetAgentInfo() strawberry.AgentInfo

func (*Agent) GetHealthStatus

func (a *Agent) GetHealthStatus() monitoring.HealthStatus

func (*Agent) OperationNamespace

func (a *Agent) OperationNamespace() string

OperationNamespace generates a special value unique across controllers which allows to mark and effectively filter its operations.

func (*Agent) Start

func (a *Agent) Start()

func (*Agent) Stop

func (a *Agent) Stop()

type Config

type Config struct {
	// Root points to root directory with operation states.
	Root ypath.Path `yson:"root"`

	// PassPeriod defines how often agent performs its passes.
	PassPeriod *yson.Duration `yson:"pass_period"`
	// CollectOperationsPeriod defines how often agent collects running operations.
	CollectOperationsPeriod *yson.Duration `yson:"collect_operations_period"`
	// RevisionCollectPeriod defines how often agent collects Cypress node revisions via batch ListNode.
	RevisionCollectPeriod *yson.Duration `yson:"revision_collect_period"`

	// Stage of the controller, e.g. production, prestable, etc.
	Stage string `yson:"stage"`

	// RobotUsername is the name of the robot from which all the operations are started.
	// It is used to check permission to the pool during setting "pool" option.
	RobotUsername string `yson:"robot_username"`

	// PassWorkerNumber is the number of workers used to process oplets.
	PassWorkerNumber *int `yson:"pass_worker_number"`

	// DefaultNetworkProject is the default network project used for oplets.
	DefaultNetworkProject *string `yson:"default_network_project"`

	// ClusterURLTemplate is a template executed via text/template library to get cluster URL.
	// Cluster URL is used for generating "fancy" links for debug purposes only.
	// If template parsing or execution fails, panic is called.
	// Available template parameters: Proxy.
	// E.g. "https://example.com/{{.Proxy}}"
	ClusterURLTemplate string `yson:"cluster_url_template"`
}

Config contains strawberry-specific configuration.

func (*Config) CollectOperationsPeriodOrDefault added in v0.0.3

func (c *Config) CollectOperationsPeriodOrDefault() yson.Duration

func (*Config) PassPeriodOrDefault

func (c *Config) PassPeriodOrDefault() yson.Duration

func (*Config) PassWorkerNumberOrDefault

func (c *Config) PassWorkerNumberOrDefault() int

func (*Config) RevisionCollectPeriodOrDefault

func (c *Config) RevisionCollectPeriodOrDefault() yson.Duration

type HealthState

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

func NewHealthState

func NewHealthState() *HealthState

func (*HealthState) Load

func (*HealthState) Store

func (s *HealthState) Store(err error)

Jump to

Keyboard shortcuts

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