registry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package registry is used to register the services. TODO: Use the `uber/fx` to manage the lifecycle of services.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ServerServiceRegistry is the global grpc service registry.
	ServerServiceRegistry = NewServerServiceRegistry()
)

Functions

This section is empty.

Types

type RegistrableService

type RegistrableService interface {
	RegisterGRPCService(g *grpc.Server)
	RegisterRESTHandler(userDefineHandlers map[string]http.Handler)
}

RegistrableService is the interface that should wraps the RegisterService method.

type ServiceBuilder

type ServiceBuilder func(bs.Server) RegistrableService

ServiceBuilder is a function that creates a grpc service.

type ServiceRegistry

type ServiceRegistry struct {
	// contains filtered or unexported fields
}

ServiceRegistry is a map that stores all registered grpc services. It implements the `ServiceRegistry` interface.

func NewServerServiceRegistry

func NewServerServiceRegistry() *ServiceRegistry

NewServerServiceRegistry creates a new ServiceRegistry.

func (*ServiceRegistry) InstallAllGRPCServices

func (r *ServiceRegistry) InstallAllGRPCServices(srv bs.Server, g *grpc.Server)

InstallAllGRPCServices installs all registered grpc services.

func (*ServiceRegistry) InstallAllRESTHandler

func (r *ServiceRegistry) InstallAllRESTHandler(srv bs.Server, h map[string]http.Handler)

InstallAllRESTHandler installs all registered REST services.

func (*ServiceRegistry) RegisterService

func (r *ServiceRegistry) RegisterService(name string, service ServiceBuilder)

RegisterService registers a grpc service.

Jump to

Keyboard shortcuts

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