v1

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateServiceRegisters

func GenerateServiceRegisters(registrations ...ServiceRegistration) map[string]ServiceRegister

GenerateServiceRegisters turns business declarations into the register map consumed by the generic server, applying the unified registration control flow: mark NOT_SERVING, mount the implementation, then mark SERVING so the generic server's startup health check passes. Declarations with an empty name or a nil Register func are skipped.

Types

type ServiceRegister

type ServiceRegister func(server *grpc.Server, healthzSvr *health.Server)

ServiceRegister is the low-level registration contract consumed by the generic server: it mounts one business service onto a grpc.Server and manages the service health status. Business code should not build it by hand; declare services via ServiceRegistration and let GenerateServiceRegisters apply the control flow.

type ServiceRegistration

type ServiceRegistration struct {
	// Name is the fully-qualified service name, used as the health status key
	// and the RA registration name.
	Name string

	// Register mounts the service implementation onto the grpc.Server
	// (e.g. pbv1.RegisterDemoServer). It must not touch the health server.
	Register func(server *grpc.Server)
}

ServiceRegistration declares one business service to register. It carries only business decisions (which service, which implementation, which pb register func); the registration control flow (health status transitions, invocation order) is owned by the framework (GenerateServiceRegisters).

func NewServiceRegistration

func NewServiceRegistration[T any](name string, impl T, register func(server *grpc.Server, srv T)) ServiceRegistration

NewServiceRegistration builds a ServiceRegistration from a pb-generated register func and its implementation, so business hooks never write registration closures:

svcregisterv1.NewServiceRegistration(name, factory.Demo(), pbv1.RegisterDemoServer)

Jump to

Keyboard shortcuts

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