Documentation
¶
Index ¶
- func NewContext(ctx context.Context, s RunnerInfo) context.Context
- func Run(opts ...RunOption) error
- type RunOption
- func WithAfterStart(fn ...func(ctx context.Context) error) RunOption
- func WithAfterStop(fn ...func(ctx context.Context) error) RunOption
- func WithBeforeStart(fn ...func(ctx context.Context) error) RunOption
- func WithBeforeStop(fn ...func(ctx context.Context) error) RunOption
- func WithContext(ctx context.Context) RunOption
- func WithEndpoints(endpoints []string) RunOption
- func WithID(id string) RunOption
- func WithLogger(logger *zap.Logger) RunOption
- func WithMetadata(metadata map[string]string) RunOption
- func WithName(name string) RunOption
- func WithServers(server ...Server) RunOption
- func WithSignals(sigs ...os.Signal) RunOption
- func WithStopTimeout(stopTimeout time.Duration) RunOption
- func WithVersion(version string) RunOption
- type Runner
- type RunnerInfo
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
func NewContext(ctx context.Context, s RunnerInfo) context.Context
NewContext 创建一个携带 RunnerInfo 的 context
Types ¶
type RunOption ¶
type RunOption func(*runner)
func WithContext ¶
func WithEndpoints ¶
func WithLogger ¶
func WithMetadata ¶
func WithServers ¶
func WithSignals ¶ added in v0.1.13
func WithStopTimeout ¶
func WithVersion ¶
type RunnerInfo ¶
type RunnerInfo interface {
ID() string
Name() string
Version() string
Metadata() map[string]string
Endpoints() []string
}
func FromContext ¶
func FromContext(ctx context.Context) (s RunnerInfo, ok bool)
FromContext 从 context 中获取 RunnerInfo
Click to show internal directories.
Click to hide internal directories.