launcher

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppRegistry = map[string]*AppDef{}
View Source
var Config map[string]*CommandConfig
View Source
var RegisterCommonFlags func(logger *zap.Logger, cmd *cobra.Command) error

Functions

func AppStatusNames

func AppStatusNames() []string

AppStatusNames returns a list of possible string values of AppStatus.

func LoadConfigFile

func LoadConfigFile(filename string) (err error)

Load reads a YAML config, and sets the global DfuseConfig variable Use the raw JSON form to provide to the different plugins and apps for them to load their config.

func ParseAppsFromArgs

func ParseAppsFromArgs(args []string, runByDefault func(string) bool) (apps []string)

func RegisterApp

func RegisterApp(logger *zap.Logger, appDef *AppDef)

func RegisterFlags

func RegisterFlags(logger *zap.Logger, cmd *cobra.Command) error

func SetAutoMaxProcs

func SetAutoMaxProcs(logger *zap.Logger)

func SetAutoMemoryLimit

func SetAutoMemoryLimit(limit uint64, logger *zap.Logger) error

func SetMaxOpenFilesLimit

func SetMaxOpenFilesLimit(logger *zap.Logger, goodEnoughMaxOpenFiles, osxStockMaxOpenFiles uint64) error

func SetupAnalyticsMetrics

func SetupAnalyticsMetrics(logger *zap.Logger, metricsListenAddr string, pprofListenAddr string)

func SetupLogger

func SetupLogger(rootLogger *zap.Logger, opts *LoggingOptions)

func SetupTracing

func SetupTracing(name string)

Types

type App

type App interface {
	Terminating() <-chan struct{}
	Terminated() <-chan struct{}
	Shutdown(err error)
	Err() error
	Run() error
}

type AppDef

type AppDef struct {
	ID            string
	Title         string
	Description   string
	RegisterFlags func(cmd *cobra.Command) error
	InitFunc      func(runtime *Runtime) error
	FactoryFunc   func(runtime *Runtime) (App, error)
}

func (*AppDef) String

func (a *AppDef) String() string

type AppInfo

type AppInfo struct {
	ID     string
	Status AppStatus
}

type AppStatus

type AppStatus uint

ENUM(

NotFound
Created
Running
Warning
Stopped

)

const (
	// AppStatusNotFound is a AppStatus of type NotFound.
	AppStatusNotFound AppStatus = iota
	// AppStatusCreated is a AppStatus of type Created.
	AppStatusCreated
	// AppStatusRunning is a AppStatus of type Running.
	AppStatusRunning
	// AppStatusWarning is a AppStatus of type Warning.
	AppStatusWarning
	// AppStatusStopped is a AppStatus of type Stopped.
	AppStatusStopped
)

func ParseAppStatus

func ParseAppStatus(name string) (AppStatus, error)

ParseAppStatus attempts to convert a string to a AppStatus

func (AppStatus) MarshalText

func (x AppStatus) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method

func (AppStatus) String

func (x AppStatus) String() string

String implements the Stringer interface.

func (*AppStatus) UnmarshalText

func (x *AppStatus) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method

type CommandConfig

type CommandConfig struct {
	Args  []string          `json:"args"`
	Flags map[string]string `json:"flags"`
}

type Launcher

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

func NewLauncher

func NewLauncher(logger *zap.Logger, absDataDir string) *Launcher

func (*Launcher) Close

func (l *Launcher) Close()

func (*Launcher) Err

func (l *Launcher) Err() error

func (*Launcher) FatalAppError

func (l *Launcher) FatalAppError(app string, err error)

func (*Launcher) GetAppIDs

func (l *Launcher) GetAppIDs() (resp []string)

func (*Launcher) GetAppStatus

func (l *Launcher) GetAppStatus(appID string) AppStatus

func (*Launcher) Launch

func (l *Launcher) Launch(appNames []string) error

func (*Launcher) StoreAndStreamAppStatus

func (l *Launcher) StoreAndStreamAppStatus(appID string, status AppStatus)

func (*Launcher) SubscribeAppStatus

func (l *Launcher) SubscribeAppStatus() *subscription

func (*Launcher) SwitchHasBeenSignaledAtomic

func (l *Launcher) SwitchHasBeenSignaledAtomic(other *atomic.Bool)

func (*Launcher) Terminating

func (l *Launcher) Terminating() <-chan string

func (*Launcher) UnsubscribeAppStatus

func (l *Launcher) UnsubscribeAppStatus(sub *subscription)

func (*Launcher) WaitForTermination

func (l *Launcher) WaitForTermination()

type LoggingOptions

type LoggingOptions struct {
	WorkingDir    string // the folder where the data will be stored, in our case will be used to store the logger
	Verbosity     int    // verbosity level
	LogFormat     string // specifies the log format
	LogToFile     bool   // specifies if we should store the logs on disk
	LogListenAddr string // address that listens to change the logs
	LogToStderr   bool   // determines if the standard console logger should log to Stderr (defaults is to log in Stdout)
}

type Runtime

type Runtime struct {
	AbsDataDir string

	// IsPendingShutdown is a function that is going to return true as soon as the initial SIGINT signal is
	// received which can be used to turn a healthz monitor as unhealthy so that a load balancer can
	// remove the node from the pool and has 'common-system-shutdown-signal-delay' to do it.
	IsPendingShutdown func() bool
}

Jump to

Keyboard shortcuts

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