grpcservice

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, service Registerer, serverConfig *connection.ServerConfig) error

Serve creates a gRPC server and listener from the config, registers the service, and serves until the context is done. For services that only implement Registerer (e.g., mock services without Run/WaitForReady).

func StartAndServe

func StartAndServe(ctx context.Context, service Service, serverConfigs ...*connection.ServerConfig) error

StartAndServe runs a full lifecycle service: starts the service, waits for it to be ready, then creates and serves gRPC server(s). Stops everything if either the service or any server exits.

Types

type Registerer

type Registerer interface {
	RegisterService(server *grpc.Server)
}

Registerer is for services that register on a gRPC server.

type Service

type Service interface {
	Registerer
	// Run executes the service until the context is done.
	Run(ctx context.Context) error
	// WaitForReady waits for the service resources to initialize.
	// If the context ended before the service is ready, returns false.
	WaitForReady(ctx context.Context) bool
}

Service is for full lifecycle services that run, signal readiness, and register on a gRPC server.

Jump to

Keyboard shortcuts

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