kernel

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 9 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) Logger added in v0.8.0

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

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)

type KernelConfig added in v0.5.0

type KernelConfig interface {
	GetHTTPPort() int
}

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 InitRoutes

func InitRoutes(cb func(r *router.Router)) 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

Jump to

Keyboard shortcuts

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