svc

package
v0.0.0-...-5e666d9 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 16 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

func RunBackground

func RunBackground(in any) context.CancelFunc

func RunBackgroundSync

func RunBackgroundSync(ctx context.Context, in any)

Types

type Background

type Background interface {
	Background(ctx context.Context)
}

type Configuration

type Configuration struct {
	Address string

	TLSOptions *tls.Config

	Options []grpc.ServerOption

	MuxExtensions []runtime.ServeMuxOption

	Gateway *ConfigurationGateway
}

func (*Configuration) RenderOptions

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

type ConfigurationGateway

type ConfigurationGateway struct {
	Address string
}

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)

	Gateway(ctx context.Context, mux *runtime.ServeMux) error
}

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, error)

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, error)

type ServiceStarter

type ServiceStarter interface {
	Wait() error

	Address() string
	HTTPAddress() 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