server

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

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 added in v0.7.0

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

func GetConfig added in v0.7.0

func GetConfig() (*Config, error)

GetConfig loads and returns the configuration

type GRPCOptions added in v0.7.0

type GRPCOptions struct {
	MaxConcurrentStreams uint32
	Interceptor          grpc.UnaryServerInterceptor
}

GRPCOptions holds gRPC-specific configuration options.

type GRPCServer added in v0.7.0

type GRPCServer interface {
	Server
	// RegisterServices allows registration of gRPC services
	RegisterServices(registerFunc func(s *grpc.Server))
}

GRPCServer defines the interface for a gRPC server.

func NewGRPCServer added in v0.7.0

func NewGRPCServer(opts ...Option) GRPCServer

NewGRPCServer creates a new gRPC server with the given options.

type GrpcServerConfig added in v0.7.0

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

type Option

type Option func(*Options)

func WithAddress

func WithAddress(address string) Option

func WithInterceptor added in v0.7.0

func WithInterceptor(interceptor grpc.UnaryServerInterceptor) Option

func WithMaxConcurrentStreams added in v0.7.0

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 Server

type Server interface {
	// Retrieve the options
	Options() Options
	// Start the server
	Start() error
	// Stop the server
	Stop() error
}

Server defines the interface for a server with methods to initialize, start, and stop the server, as well as retrieve its options.

Jump to

Keyboard shortcuts

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