grpc

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAddress = ":0"
	DefaultName    = "go.ebrick.server"
	DefaultVersion = "latest"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Grpc GrpcServerConfig `yaml:"grpc"`
}

func GetConfig

func GetConfig() (*Config, error)

GetConfig loads and returns the configuration

type GRPCOptions

type GRPCOptions struct {
	MaxConcurrentStreams uint32
	Interceptor          grpc.UnaryServerInterceptor
}

GRPCOptions holds gRPC-specific configuration options.

type GRPCServer

type GRPCServer interface {
	Options() Options

	transport.Server
	// RegisterServices allows registration of gRPC services
	RegisterService(registerFunc func(s *grpc.Server))
}

GRPCServer defines the interface for a gRPC server.

func NewGRPCServer

func NewGRPCServer(opts ...Option) GRPCServer

NewGRPCServer creates a new gRPC server with the given options.

type GrpcServerConfig

type GrpcServerConfig struct {
	Enabled bool   `yaml:"enabled"`
	Address string `yaml:"address"`
}

type Option

type Option func(*Options)

func WithAddress

func WithAddress(address string) Option

func WithInterceptor

func WithInterceptor(interceptor grpc.UnaryServerInterceptor) Option

func WithMaxConcurrentStreams

func WithMaxConcurrentStreams(maxStreams uint32) Option

func WithName

func WithName(name string) Option

func WithVersion

func WithVersion(version string) Option

type Options

type Options struct {
	Address     string
	Name        string
	Version     string
	GRPCOptions GRPCOptions
}

type ServiceRegistrar

type ServiceRegistrar interface {
	RegisterGRPCServices(s GRPCServer)
}

Jump to

Keyboard shortcuts

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