opts

package
v0.0.0-...-1d0ba01 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultVerbose ...
	DefaultVerbose = false
	// DefaultTermSignal is the signal to term the agent.
	DefaultTermSignal = syscall.SIGTERM
	// DefaultReloadSignal is the default signal for reload.
	DefaultReloadSignal = syscall.SIGHUP
	// DefaultKillSignal is the default signal for termination.
	DefaultKillSignal = syscall.SIGINT
)

Variables

View Source
var (
	// ErrNotFound signals that this option is not set.
	ErrNotFound = fmt.Errorf("option not found")
)

Functions

This section is empty.

Types

type DefaultOptions

type DefaultOptions struct {
	Options
}

DefaultOptions are a collection of default options.

func (*DefaultOptions) KillSignal

func (o *DefaultOptions) KillSignal() syscall.Signal

KillSignal ...

func (*DefaultOptions) ReloadSignal

func (o *DefaultOptions) ReloadSignal() syscall.Signal

ReloadSignal ...

func (*DefaultOptions) TermSignal

func (o *DefaultOptions) TermSignal() syscall.Signal

TermSignal ...

func (*DefaultOptions) Verbose

func (o *DefaultOptions) Verbose() bool

Verbose ...

type DefaultOpts

type DefaultOpts interface {
	// Verbose ...
	Verbose() bool
	// ReloadSignal ...
	ReloadSignal() syscall.Signal
	// TermSignal ...
	TermSignal() syscall.Signal
	// KillSignal ...
	KillSignal() syscall.Signal

	Opts
}

DefaultOpts ...

func NewDefaultOpts

func NewDefaultOpts(opts ...OptFunc) DefaultOpts

NewDefaultOpts returns options with a default configuration.

type Opt

type Opt int

Opt ...

const (
	// Verbose ...
	Verbose Opt = iota
	// ReloadSignal ...
	ReloadSignal
	// TermSignal ...
	TermSignal
	// KillSignal ...
	KillSignal
	// Logger ...
	Logger
)

type OptFunc

type OptFunc func(Opts)

OptFunc is an option

func WithLogger

func WithLogger(logger *zap.Logger) OptFunc

WithLogger is setting a logger for options.

type Options

type Options struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Options is default options structure.

func (*Options) Configure

func (o *Options) Configure(opts ...OptFunc)

Configure os configuring the options.

func (*Options) Get

func (o *Options) Get(opt Opt) (interface{}, error)

Get ...

func (*Options) Set

func (o *Options) Set(opt Opt, v interface{})

Set ...

type Opts

type Opts interface {
	// Get ...
	Get(Opt) (interface{}, error)
	// Set ...
	Set(Opt, interface{})
	// Configure ...
	Configure(...OptFunc)
}

Opts ...

func New

func New(opts ...OptFunc) Opts

New returns a new instance of the options.

Jump to

Keyboard shortcuts

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