app

package
v0.0.0-...-ed2fce9 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCustom

func InitCustom(customApp App) error

InitCustom

Types

type App

type App interface {
	app.App

	InstanceID() string

	AddService(service.Service)
	IsAllServicesReady() bool

	Run(context.Context)

	// Status reports the app's overall status including all services.
	// This method is designed to be used in health checks.
	Status() service.Status
}

App abstracts the application itself. There should be only one instance for a running instance of an app.

func Init

func Init(appInfo app.Info, opts InitOpts) (App, error)

Instantiate global instance of App with the default implementation.

func Instance

func Instance() App

type AppBase

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

AppBase is the base layer for an app.

func (*AppBase) AddService

func (appBase *AppBase) AddService(srv service.Service)

AddService adds a service to be run simultaneously. Do NOT call this method after the app has been started.

func (*AppBase) AppInfo

func (appBase *AppBase) AppInfo() app.Info

func (*AppBase) InstanceID

func (appBase *AppBase) InstanceID() string

func (*AppBase) IsAllServicesReady

func (appBase *AppBase) IsAllServicesReady() bool

IsAllServicesReady checks if every service is ready to accept clients.

func (*AppBase) Run

func (appBase *AppBase) Run(ctx context.Context)

Run runs all the services. Do NOT add any new service after this method was called.

func (*AppBase) Services

func (appBase *AppBase) Services() []service.Service

Services returns an array of services added to this app.

func (*AppBase) Status

func (appBase *AppBase) Status() service.Status

type InitOpts

type InitOpts struct {
	Logger *slog.Logger `env:"-"`
}

Jump to

Keyboard shortcuts

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