service

package
v0.0.0-...-6cce6f8 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package service contains all of the code for the example agents services.

Index

Constants

View Source
const (
	// LinuxConfigPath is the default path to agent configuration file on linux.
	LinuxConfigPath = `/etc/google-cloud-example-agent/configuration.json`
	// WindowsConfigPath is the default path to agent configuration file on windows.
	WindowsConfigPath = `C:\Program Files\Google\google-cloud-example-agent\conf\configuration.json`
)

Variables

This section is empty.

Functions

func NewDaemonSubcommand

func NewDaemonSubcommand(ctx context.Context, daemon *Daemon) *cobra.Command

NewDaemonSubcommand creates a new Command using the provided daemon for work.

func PopulateDaemonFlagValues

func PopulateDaemonFlagValues(daemon *Daemon, fs *pflag.FlagSet)

PopulateDaemonFlagValues uses the provided flags to set the daemon's primitive values.

Types

type Daemon

type Daemon struct {
	Integration *cpb.Integration
	// contains filtered or unexported fields
}

Daemon has args for daemon subcommand.

func NewDaemon

func NewDaemon(lp log.Parameters, cloudProps *cpb.CloudProperties, integration *cpb.Integration) *Daemon

NewDaemon creates a new Daemon.

func (*Daemon) Execute

func (d *Daemon) Execute(ctx context.Context) error

Execute runs the daemon command.

type Fast

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

Fast implements the Service interface for the fast service.

func (*Fast) ErrorCode

func (s *Fast) ErrorCode() int

ErrorCode returns the error code for the fast service.

func (*Fast) ExpectedMinDuration

func (s *Fast) ExpectedMinDuration() time.Duration

ExpectedMinDuration returns the expected minimum duration for the fast service. Used by the recovery handler to determine if the service ran long enough to be considered successful.

func (*Fast) Start

func (s *Fast) Start(ctx context.Context, a any)

Start starts the fast service.

func (*Fast) String

func (s *Fast) String() string

String returns the name of the fast service.

type Service

type Service interface {
	Start(ctx context.Context, a any)
	String() string
	ErrorCode() int
	ExpectedMinDuration() time.Duration
}

Service defines the common interface for integration services. Start method is used to start the integration services.

type Slow

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

Slow implements the Service interface for the slow service.

func (*Slow) ErrorCode

func (s *Slow) ErrorCode() int

ErrorCode returns the error code for the slow service.

func (*Slow) ExpectedMinDuration

func (s *Slow) ExpectedMinDuration() time.Duration

ExpectedMinDuration returns the expected minimum duration for the slow service. Used by the recovery handler to determine if the service ran long enough to be considered successful.

func (*Slow) Start

func (s *Slow) Start(ctx context.Context, a any)

Start starts the s;pw service.

func (*Slow) String

func (s *Slow) String() string

String returns the name of the slow service.

Jump to

Keyboard shortcuts

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