nacelle

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: MIT Imports: 6 Imported by: 28

README

Nacelle logo

Nacelle GoDoc CircleCI Coverage Status

Service framework written in Go.


For more details, see the website and the getting started gide.

Goals

Core goals:

  • Provide a common convention for application organization so that developers can quickly dive into the meaningful logic of an application.
  • Support a common convention for declaring, reading, and validating configuration values from the runtime environment.
  • Support a common convention for registering, declaring, and injecting struct and interface dependencies.
  • Support a common convention for structured logging.

Additional goals:

  • Provide additional non-core functionality via separate opt-in libraries. Keep the dependencies for the core-functionality minimal.
  • Operate within existing infrastructures and do not require tools or technologies outside of what this project provides.

Non-goals

  • Impose opinions on service discovery.
  • Impose opinions on inter-process or inter-service communication.
  • Impose opinions on runtime environment, deployment, or orchestration of services.

Documentation

Index

Constants

View Source
const (
	LevelDebug   = log.LevelDebug
	LevelError   = log.LevelError
	LevelFatal   = log.LevelFatal
	LevelInfo    = log.LevelInfo
	LevelWarning = log.LevelWarning
)

Variables

View Source
var (
	NewConfig                   = config.NewConfig
	NewDefaultTagSetter         = config.NewDefaultTagSetter
	NewDirectorySourcer         = config.NewDirectorySourcer
	NewEnvSourcer               = config.NewEnvSourcer
	NewEnvTagPrefixer           = config.NewEnvTagPrefixer
	NewFlagSourcer              = config.NewFlagSourcer
	NewFlagTagPrefixer          = config.NewFlagTagPrefixer
	NewFlagTagSetter            = config.NewFlagTagSetter
	NewFileSourcer              = config.NewFileSourcer
	NewFileTagPrefixer          = config.NewFileTagPrefixer
	NewFileTagSetter            = config.NewFileTagSetter
	NewGlobSourcer              = config.NewGlobSourcer
	NewMultiSourcer             = config.NewMultiSourcer
	NewOptionalDirectorySourcer = config.NewOptionalDirectorySourcer
	NewOptionalFileSourcer      = config.NewOptionalFileSourcer
	NewTestEnvSourcer           = config.NewTestEnvSourcer
	NewTOMLFileSourcer          = config.NewTOMLFileSourcer
	NewYAMLFileSourcer          = config.NewYAMLFileSourcer
	ParseTOML                   = config.ParseTOML
	ParseYAML                   = config.ParseYAML
	WithDirectorySourcerFS      = config.WithDirectorySourcerFS
	WithFileSourcerFS           = config.WithFileSourcerFS
	WithGlobSourcerFS           = config.WithGlobSourcerFS
)
View Source
var (
	EmergencyLogger    = log.EmergencyLogger
	LogEmergencyError  = log.LogEmergencyError
	LogEmergencyErrors = log.LogEmergencyErrors
	NewNilLogger       = log.NewNilLogger
	NewReplayAdapter   = log.NewReplayAdapter
	NewRollupAdapter   = log.NewRollupAdapter
)
View Source
var (
	NewHealth                  = process.NewHealth
	NewParallelInitializer     = process.NewParallelInitializer
	NewProcessContainer        = process.NewProcessContainer
	WithHealthCheckInterval    = process.WithHealthCheckInterval
	WithInitializerName        = process.WithInitializerName
	WithInitializerLogFields   = process.WithInitializerLogFields
	WithInitializerTimeout     = process.WithInitializerTimeout
	WithPriority               = process.WithPriority
	WithProcessInitTimeout     = process.WithProcessInitTimeout
	WithProcessName            = process.WithProcessName
	WithProcessLogFields       = process.WithProcessLogFields
	WithProcessShutdownTimeout = process.WithProcessShutdownTimeout
	WithProcessStartTimeout    = process.WithProcessStartTimeout
	WithShutdownTimeout        = process.WithShutdownTimeout
	WithSilentExit             = process.WithSilentExit
	WithStartTimeout           = process.WithStartTimeout
)
View Source
var (
	NewServiceContainer = service.NewServiceContainer
	Overlay             = service.Overlay
)

Functions

This section is empty.

Types

type AppInitFunc

type AppInitFunc func(ProcessContainer, ServiceContainer) error

AppInitFunc is an program entrypoint called after performing initial configuration loading, sanity checks, and setting up loggers. This function should register initializers and processes and inject values into the service container where necessary.

type Bootstrapper

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

Bootstrapper wraps the entrypoint to the program.

func NewBootstrapper

func NewBootstrapper(
	name string,
	initFunc AppInitFunc,
	bootstrapperConfigs ...BootstrapperConfigFunc,
) *Bootstrapper

NewBootstrapper creates an entrypoint to the program with the given configs.

func (*Bootstrapper) Boot

func (bs *Bootstrapper) Boot() int

Boot will initialize services and return a status code. This method does not return in any meaningful way (it blocks until the associated process runner has completed).

func (*Bootstrapper) BootAndExit

func (bs *Bootstrapper) BootAndExit()

BootAndExit calls Boot and sets the program return code on halt. This method does not return.

type BootstrapperConfigFunc

type BootstrapperConfigFunc func(*bootstrapperConfig)

BootstrapperConfigFunc is a function used to configure an instance of a Bootstrapper.

func WithConfigMaskedKeys

func WithConfigMaskedKeys(configMaskedKeys []string) BootstrapperConfigFunc

WithConfigMaskedKeys sets the keys that are redacted when printed by the config logger.

func WithConfigSourcer

func WithConfigSourcer(configSourcer ConfigSourcer) BootstrapperConfigFunc

WithConfigSourcer sets the source that should be used for populating config structs.

func WithLoggingFields

func WithLoggingFields(loggingFields LogFields) BootstrapperConfigFunc

WithLoggingFields sets additional fields sent with every log message.

func WithLoggingInitFunc

func WithLoggingInitFunc(loggingInitFunc LoggingInitFunc) BootstrapperConfigFunc

WithLoggingInitFunc sets the function that initializes logging.

func WithRunnerOptions

func WithRunnerOptions(configs ...RunnerConfigFunc) BootstrapperConfigFunc

WithRunnerOptions passes RunnerConfigFuncs to the runner created by Boot.

type Config

type Config = config.Config

func NewLoggingConfig

func NewLoggingConfig(config Config, logger Logger, maskedKeys []string) Config

type ConfigSourcer

type ConfigSourcer = config.Sourcer

type FileParser

type FileParser = config.FileParser

type FileSystem added in v1.1.2

type FileSystem = config.FileSystem

type Finalizer added in v1.0.2

type Finalizer = process.Finalizer

type Health

type Health = process.Health

type Initializer

type Initializer = process.Initializer

type InitializerConfigFunc

type InitializerConfigFunc = process.InitializerConfigFunc

type InitializerFunc

type InitializerFunc = process.InitializerFunc

func WrapServiceInitializerFunc

func WrapServiceInitializerFunc(container ServiceContainer, f ServiceInitializerFunc) InitializerFunc

WrapServiceInitializerFunc creates an InitializerFunc from a ServiceInitializerFunc and a container.

type LogFields

type LogFields = log.LogFields

type LogLevel

type LogLevel = log.LogLevel

type Logger

type Logger = log.Logger

type LoggingInitFunc

type LoggingInitFunc func(Config) (Logger, error)

LoggingInitFunc creates a factory from a config object.

type ParallelInitializer

type ParallelInitializer = process.ParallelInitializer

type Process

type Process = process.Process

type ProcessConfigFunc

type ProcessConfigFunc = process.ProcessConfigFunc

type ProcessContainer

type ProcessContainer = process.ProcessContainer

type ReplayLogger

type ReplayLogger = log.ReplayLogger

type RunnerConfigFunc

type RunnerConfigFunc = process.RunnerConfigFunc

type ServiceContainer

type ServiceContainer = service.ServiceContainer

type ServiceInitializerFunc

type ServiceInitializerFunc func(config Config, container ServiceContainer) error

ServiceInitializerFunc is an InitializerFunc with a service container argument.

type TagModifier

type TagModifier = config.TagModifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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