common

package
v5.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitSuccess = iota
	ExitInvalidApikey
	ExitInvalidConfiguration
	ExitRedisInitializationFailed
	ExitErrorDB
	ExitTaskInitialization
	ExitAdminError
	ExitTLSError
	ExitUndefined
)

Exit codes

Variables

View Source
var ErrShutdownAlreadyRegistered = errors.New("shutdown handler already scheduled")

ErrShutdownAlreadyRegistered is returned when trying to register the shutdown handler more than once

Functions

This section is empty.

Types

type InitializationError

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

InitializationError wraps an error and an exit code

func NewInitError

func NewInitError(err error, exitCode int) *InitializationError

NewInitError constructs an initialization error

func (*InitializationError) Error

func (e *InitializationError) Error() string

Error returns the string representation of the error causing the initialization failure

func (*InitializationError) ExitCode

func (e *InitializationError) ExitCode() int

ExitCode is the number to return to the OS

type Runtime

type Runtime interface {
	Uptime() time.Duration
	Shutdown()
	Kill()
}

Runtime defines the interface

type RuntimeImpl

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

RuntimeImpl provides an implementation for the Runtime interface

func NewRuntime

func NewRuntime(
	proxy bool,
	syncManager synchronizer.Manager,
	logger logging.LoggerInterface,
	dashboardTitle string,
	listener impressionlistener.ImpressionBulkListener,
	slackWriter *log.SlackWriter,
	appMonitor application.MonitorIterface,
	servicesMonitor services.MonitorIterface,
) *RuntimeImpl

NewRuntime constructs a RuntimeImpl object

func (*RuntimeImpl) Block

func (r *RuntimeImpl) Block()

Block puts the current goroutine on hold until Shutdown is complete

func (*RuntimeImpl) Kill

func (r *RuntimeImpl) Kill()

Kill sends a SIGKILL and aborts the app immediately

func (*RuntimeImpl) RegisterShutdownHandler

func (r *RuntimeImpl) RegisterShutdownHandler() error

RegisterShutdownHandler installs a shutdown handler that will be triggered when a SIGTERM/SIGQUIT/SIGINT is received

func (*RuntimeImpl) Shutdown

func (r *RuntimeImpl) Shutdown()

Shutdown stops sends a SIGTERM to the current process

func (*RuntimeImpl) Uptime

func (r *RuntimeImpl) Uptime() time.Duration

Uptime returns how long the sync has been running

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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