svc

package
v0.0.0-...-44f2bf6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, health HealthService, services ...Service) error

Types

type Configuration

type Configuration struct {
	Address string

	TLSOptions *tls.Config

	Options []grpc.ServerOption
}

func (*Configuration) RenderOptions

func (c *Configuration) RenderOptions() []grpc.ServerOption

type GRPCErrorStatus

type GRPCErrorStatus interface {
	error

	GRPCStatus() *status.Status
}

func AsGRPCErrorStatus

func AsGRPCErrorStatus(err error) (GRPCErrorStatus, bool)

type Handler

type Handler interface {
	Name() string

	Health() HealthState

	Register(registrar *grpc.Server)
}

type Health

type Health interface {
	Update(key string, state HealthState)
}

type HealthService

type HealthService interface {
	Handler

	Service

	Health
}

func NewHealthService

func NewHealthService(cfg Configuration, t HealthType, handlers ...Handler) HealthService

type HealthState

type HealthState int
const (
	Unhealthy HealthState = iota
	Degraded
	Healthy
)

type HealthType

type HealthType int
const (
	Readiness HealthType = iota
	Liveness
	Startup
)

type Service

type Service interface {
	Start(ctx context.Context) ServiceStarter

	StartWithHealth(ctx context.Context, health Health) ServiceStarter
}

func NewService

func NewService(cfg Configuration, handlers ...Handler) Service

type ServiceStarter

type ServiceStarter interface {
	Wait() error

	Address() string
}

type Shutdown

type Shutdown interface {
	Shutdown(cancelFunc context.CancelFunc)
}

Jump to

Keyboard shortcuts

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