kernel

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 10 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyBootstrapped = errors.New("kernel already bootstrapped")
)

Functions

This section is empty.

Types

type Kernel

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

func New

func New[T KernelConfig](options ...KernelOption) *Kernel

func (*Kernel) Bootstrap

func (k *Kernel) Bootstrap(ctx context.Context) error

func (*Kernel) Config added in v0.11.0

func (k *Kernel) Config() KernelConfig

func (*Kernel) Logger added in v0.8.0

func (k *Kernel) Logger(ctx context.Context) *slog.Logger

func (*Kernel) RootHandler added in v0.11.0

func (k *Kernel) RootHandler(ctx context.Context) http.Handler

func (*Kernel) Run

func (k *Kernel) Run(ctx context.Context) error

func (*Kernel) RunHttpServer added in v0.5.0

func (k *Kernel) RunHttpServer(ctx context.Context) error

func (*Kernel) RunServices added in v0.5.0

func (k *Kernel) RunServices(ctx context.Context)

func (*Kernel) Validate added in v0.11.0

func (k *Kernel) Validate(ctx context.Context) error

type KernelConfig added in v0.5.0

type KernelConfig interface {
	GetHTTPPort() int
	GetBaseURL() string
}

type KernelOption

type KernelOption func(*Kernel) *Kernel

func Bootstrap

func Bootstrap(bootstrap ...func(context.Context) error) KernelOption

func Config added in v0.5.0

func Config[T KernelConfig](cb func() T) KernelOption

func RootHandler

func RootHandler(rootHandler func(ctx context.Context) http.Handler) KernelOption

func Services added in v0.3.0

func Services(services ...Service) KernelOption

type Restarter added in v0.5.0

type Restarter interface {
	Restart()
}

type Service added in v0.3.0

type Service interface {
	Run(ctx context.Context) error
	Name() string
}

type ServiceFunc added in v0.3.0

type ServiceFunc func() error

func (ServiceFunc) Restart added in v0.3.0

func (s ServiceFunc) Restart() bool

func (ServiceFunc) Run added in v0.3.0

func (s ServiceFunc) Run(ctx context.Context) error

type ServiceFuncRestart added in v0.3.0

type ServiceFuncRestart func() error

func (ServiceFuncRestart) Run added in v0.3.0

type Validator added in v0.11.0

type Validator interface {
	Validate(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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