server

package
v1.17.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package server provides examples of how to use the unified ServerManager for different server configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleBothServers

func ExampleBothServers()

ExampleBothServers demonstrates how to use ServerManager with both HTTP and gRPC servers. This is the main advantage of the unified approach - both servers are coordinated properly.

func ExampleGRPCOnly

func ExampleGRPCOnly()

ExampleGRPCOnly demonstrates how to use ServerManager with only a gRPC server.

func ExampleHTTPOnly

func ExampleHTTPOnly()

ExampleHTTPOnly demonstrates how to use ServerManager with only an HTTP server.

func ExampleMigrationFromOldAPI

func ExampleMigrationFromOldAPI()

ExampleMigrationFromOldAPI demonstrates how to migrate from the old API to the new unified API.

Types

type GracefulShutdown

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

GracefulShutdown handles the graceful shutdown of application components. It's designed to be reusable across different services. Deprecated: Use ServerManager instead for better coordination.

func NewGracefulShutdown

func NewGracefulShutdown(
	app *fiber.App,
	grpcServer *grpc.Server,
	licenseClient *license.ManagerShutdown,
	telemetry *opentelemetry.Telemetry,
	logger log.Logger,
) *GracefulShutdown

NewGracefulShutdown creates a new instance of GracefulShutdown. Deprecated: Use NewServerManager instead for better coordination.

func (*GracefulShutdown) HandleShutdown

func (gs *GracefulShutdown) HandleShutdown()

HandleShutdown sets up signal handling and executes the shutdown sequence when a termination signal is received. Deprecated: Use ServerManager.StartWithGracefulShutdown() instead.

type ServerManager

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

ServerManager handles the graceful shutdown of multiple server types. It can manage HTTP servers, gRPC servers, or both simultaneously.

func NewServerManager

func NewServerManager(
	licenseClient *license.ManagerShutdown,
	telemetry *opentelemetry.Telemetry,
	logger log.Logger,
) *ServerManager

NewServerManager creates a new instance of ServerManager.

func (*ServerManager) StartWithGracefulShutdown

func (sm *ServerManager) StartWithGracefulShutdown()

StartWithGracefulShutdown initializes all configured servers and sets up graceful shutdown.

func (*ServerManager) WithGRPCServer

func (sm *ServerManager) WithGRPCServer(server *grpc.Server, address string) *ServerManager

WithGRPCServer configures the gRPC server for the ServerManager.

func (*ServerManager) WithHTTPServer

func (sm *ServerManager) WithHTTPServer(app *fiber.App, address string) *ServerManager

WithHTTPServer configures the HTTP server for the ServerManager.

Jump to

Keyboard shortcuts

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