runtime

package
v0.0.0-...-cafa37b Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

View Source
const (
	MetaOptionEnvPrefix   = "envPrefix"
	MetaOptionVersion     = "version"
	MetaOptionDescription = "description"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GRPC() client.GRPCClient
	HTTP() client.HTTPClient
}

type Config

type Config interface {
	Provide(...any) error

	SetMeta(meta *meta.Meta)
	Parse(v interface{}, prefix string, opts ...env.Options) error
	Print(v interface{}, prefix string)
	PrintTable(all, nocomments bool) string
	PrintYaml(all, nocomments bool) string

	Configs() []any
}

type HTTPClient

type HTTPClient interface {
	Get() error
	Post() error
}

type Option

type Option interface {
	Name() string
	Value() string
}

func WithDescription

func WithDescription(description string) Option

func WithEnvPrefix

func WithEnvPrefix(prefix string) Option

func WithVersion

func WithVersion(version string) Option

type Options

type Options []Option

type Package

type Package interface {
	Provide(constructor ...interface{})

	Constructors() []interface{}
	Register(packages []toolkit.PackageItem)

	PreStart(ctx context.Context) error
	OnStart(ctx context.Context) error
	OnStop(ctx context.Context) error
}

type Plugin

type Plugin interface {
	Provide(constructor ...interface{})

	Constructors() []interface{}
	Register(plugins []toolkit.Plugin)

	PreStart(ctx context.Context) error
	OnStart(ctx context.Context) error
	OnStop(ctx context.Context) error
}

type Runtime

type Runtime interface {
	Meta() *meta.Meta
	Log() logger.Logger

	Client() Client
	Package() Package
	Server() Server
	Config() Config
	Plugin() Plugin

	Tools() Tools

	Service() toolkit.Service

	Provide(constructor interface{})
	Invoke(constructor interface{})

	Start(ctx context.Context) error
	Stop(ctx context.Context, err error)

	RegisterOnStartHook(fn ...func(ctx context.Context) error)
	RegisterOnStartSyncHook(fn ...func(ctx context.Context) error)

	RegisterOnStopHook(fn ...func(ctx context.Context) error)
	RegisterOnStopSyncHook(fn ...func(ctx context.Context) error)
}

type Server

type Server interface {
	toolkit.Server

	Start(ctx context.Context) error
	Stop(ctx context.Context) error

	HTTPList() map[string]server.HTTPServer
	GRPCList() map[string]server.GRPCServer

	Provides() []interface{}
	Constructors() []interface{}
}

type Tools

type Tools interface {
	OnStart(ctx context.Context) error

	Metrics() metrics.Metrics
	Probes() probes.Probes
	Traces() traces.Traces
}

Directories

Path Synopsis
zap

Jump to

Keyboard shortcuts

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