Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminConfig ¶
func NewAdminConfig ¶
type AdminServer ¶
type AdminServer struct {
// contains filtered or unexported fields
}
func StartAdminServer ¶
func StartAdminServer(cfg AdminConfig, state AdminState) (*AdminServer, error)
type AdminState ¶
type AdminState struct {
IsAlive func() bool
IsReady func() bool
Info func() InfoSnapshot
Components func() []ComponentStatus
}
type BuildInfo ¶ added in v1.2.3
type BuildInfo struct {
Path string `json:"path,omitempty"`
Version string `json:"version,omitempty"`
GoVersion string `json:"go_version,omitempty"`
GOOS string `json:"go_os,omitempty"`
GOARCH string `json:"go_arch,omitempty"`
VCSRevision string `json:"vcs_revision,omitempty"`
VCSTime string `json:"vcs_time,omitempty"`
VCSDirty string `json:"vcs_dirty,omitempty"`
}
type ComponentStatus ¶ added in v1.2.3
type InfoSnapshot ¶ added in v1.2.3
type InfoSnapshot struct {
Service string `json:"service"`
Alive bool `json:"alive"`
Ready bool `json:"ready"`
Phase string `json:"phase,omitempty"`
StartedAt string `json:"started_at,omitempty"`
PhaseSince string `json:"phase_since,omitempty"`
Uptime string `json:"uptime,omitempty"`
LastReloadAt string `json:"last_reload_at,omitempty"`
LastError string `json:"last_error,omitempty"`
Build BuildInfo `json:"build"`
}
type LoggerConfig ¶
type Options ¶
type Options struct {
ServiceName string
ShutdownTimeout time.Duration
LoadConfig func() error
BuildInfo func() BuildInfo
LoggerConfig func() LoggerConfig
AdminConfig func() AdminConfig
ComponentStatuses func() []ComponentStatus
InitDeps func() error
RegisterHandlers func() error
StartRuntime func() error
OnProc func() bool
OnTick func(lastMs, nowMs int64)
// OnShutdown runs before admin shutdown / OnExit and should perform
// graceful, timeout-bound runtime stop work.
OnShutdown func(ctx context.Context) error
// OnExit runs after graceful shutdown attempts and is meant for final
// best-effort cleanup/logging.
OnExit func()
}
type ServiceApp ¶
type ServiceApp struct {
// contains filtered or unexported fields
}
func NewServiceApp ¶
func NewServiceApp(opts Options) *ServiceApp
func (*ServiceApp) OnExit ¶
func (a *ServiceApp) OnExit()
func (*ServiceApp) OnInit ¶
func (a *ServiceApp) OnInit() error
func (*ServiceApp) OnProc ¶
func (a *ServiceApp) OnProc() bool
func (*ServiceApp) OnReload ¶
func (a *ServiceApp) OnReload() error
func (*ServiceApp) OnTick ¶
func (a *ServiceApp) OnTick(lastMs, nowMs int64)
Click to show internal directories.
Click to hide internal directories.