kernel

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Register

func Register[T salusaconfig.Config](fn func(ctx context.Context, c T)) func(ctx context.Context) error

Types

type Kernel

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

func New

func New(options ...KernelOption) *Kernel

func (*Kernel) APIDoc

func (k *Kernel) APIDoc(ctx context.Context) (*spec.Swagger, error)

Operation implements openapidoc.Operationer.

func (*Kernel) Bootstrap

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

func (*Kernel) Close

func (k *Kernel) Close() error

func (*Kernel) Config

func (k *Kernel) Config() salusaconfig.Config

func (*Kernel) HttpServer

func (k *Kernel) HttpServer(ctx context.Context) *http.Server

func (*Kernel) RootHandler

func (k *Kernel) RootHandler() http.Handler

func (*Kernel) Run

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

func (*Kernel) RunHttpServer

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

func (*Kernel) StartServices

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

func (*Kernel) Validate

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

type KernelOption

type KernelOption func(*Kernel) *Kernel

func APIDocumentation

func APIDocumentation(options ...openapidoc.SwaggerOption) KernelOption

func Bootstrap

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

func Config

func Config[T salusaconfig.Config](cb func() T) KernelOption

func FetchAuth

func FetchAuth(cb func(ctx context.Context, username string, request *http.Request) error) KernelOption

func InitRoutes

func InitRoutes(cb func(r *router.Router)) KernelOption

func Middleware

func Middleware(globalMiddleware []router.Middleware) KernelOption

func RootHandler

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

func Services

func Services(services ...Service) KernelOption

type ResponseWriter

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

func NewStdoutResponseWriter

func NewStdoutResponseWriter() *ResponseWriter

func (*ResponseWriter) Header

func (s *ResponseWriter) Header() http.Header

Header implements http.ResponseWriter.

func (*ResponseWriter) Ok

func (w *ResponseWriter) Ok() bool

func (*ResponseWriter) Status

func (w *ResponseWriter) Status() int

func (*ResponseWriter) Write

func (s *ResponseWriter) Write(b []byte) (int, error)

Write implements http.ResponseWriter.

func (*ResponseWriter) WriteHeader

func (s *ResponseWriter) WriteHeader(statusCode int)

WriteHeader implements http.ResponseWriter.

type Restarter

type Restarter interface {
	Restart()
}

type Service

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

type ServiceFunc

type ServiceFunc func() error

func (ServiceFunc) Run

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

type ServiceFuncRestart

type ServiceFuncRestart func() error

func (ServiceFuncRestart) Restart

func (s ServiceFuncRestart) Restart()

func (ServiceFuncRestart) Run

Jump to

Keyboard shortcuts

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