core

package
v0.0.0-...-37b9b4a Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionLatest  = config.VersionLatest  // Latest supported version
	VersionUnknown = config.VersionUnknown // Used when version is not specified
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Runner)

Option represents a functional option for configuring Runner.

func WithConfigCallback

func WithConfigCallback(callback func() *pb.ServerConfig) Option

WithConfigCallback sets the function that will be called to load or reload configuration. This option is required when creating a new Runner.

func WithContext

func WithContext(ctx context.Context) Option

WithContext sets a custom context for the Runner instance. This allows for more granular control over cancellation and timeouts.

func WithLogHandler

func WithLogHandler(handler slog.Handler) Option

WithLogHandler sets a custom slog handler for the Runner instance. For example, to use a custom JSON handler with debug level:

handler := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug})

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets a logger for the Runner instance.

type Runner

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

Runner implements the supervisor.Runnable and supervisor.Reloadable interfaces.

func New

func New(opts ...Option) (*Runner, error)

New creates a new Runner instance

func (*Runner) Reload

func (r *Runner) Reload()

Reload implements the Reloadable interface and reloads the Runner with the latest configuration

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run implements the Runnable interface and starts the Runner

func (*Runner) Stop

func (r *Runner) Stop()

Stop implements the Runnable interface and stops the Runner

func (*Runner) String

func (r *Runner) String() string

Jump to

Keyboard shortcuts

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