svc

package
v0.0.0-...-bb45038 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 8 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

	Options []grpc.ServerOption
}

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 {
	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