Documentation
¶
Index ¶
Constants ¶
View Source
const (
LogFieldKeyName = "__advapp_name"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App interface { // Checkers 提供一组健康检查,用于响应 HTTP 健康检查接口 Checkers() []Checker // Run 提供服务主运行方法,正常情况下,此方法需要长期运行 Run(ctx context.Context, ld advconf.Loader) (err error) // Stop 提供停止方法,执行该方法后,Run 方法应该优雅退出,且没有 error 返回 Stop(ctx context.Context) (err error) }
App App 接口用于抽象最基础的业务服务,包含健康检查,运行和停止三个方法
type Check ¶
type Check struct {
// contains filtered or unexported fields
}
Check 健康检查工具
type CheckOptions ¶
type CheckOptions struct { // Checkers 健康检查条目 Checkers []Checker // Cascade 级联值,如果连续 Ready 失败次数超过这个值会触发 Alive 失败 Cascade int64 }
CheckOptions Check 构建参数
type CheckerFunc ¶
CheckerFunc 健康检查函数
type WebApp ¶
type WebApp interface { // Checkers 提供一组健康检查,用于响应 HTTP 健康检查接口 Checkers() []Checker // Setup 提供初始化依赖项方法 Setup(ctx context.Context, ld advconf.Loader) (err error) // Route 提供挂载路由方法 Route(ctx context.Context, g *echo.Group) // Teardown 提供停止方法,且没有必要返回 error Teardown(ctx context.Context) }
WebApp WebApp 接口用于抽象 Web 服务,包含健康检查,依赖项初始化,路由挂载和停止方法
Click to show internal directories.
Click to hide internal directories.