server

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package server is a simple GRPC service performing useless memory allocations. Consider it as en example of MemLimiter integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MemLimiter     *memlimiter.Config `json:"memLimiter"` //nolint:tagliatelle
	Tracker        *tracker.Config    `json:"tracker"`
	ListenEndpoint string             `json:"listen_endpoint"`
}

Config - a top-level service configuration.

func (*Config) Prepare

func (c *Config) Prepare() error

Prepare validates config.

type Server

type Server interface {
	schema.AllocatorServer
	// Run starts the server (a blocking call).
	Run() error
	// Quit terminates the server gracefully.
	Quit()
	// GRPCServer returns the underlying server implementation. Only for testing purposes.
	GRPCServer() *grpc.Server
	// MemLimiter returns the internal MemLimiter object. Only for testing purposes.
	MemLimiter() memlimiter.Service
	// Tracker returns the statistics tracker. Only for testing purposes.
	Tracker() *tracker.Tracker
}

Server is the interface for the Allocator service.

func NewServer added in v0.0.2

func NewServer(logger logr.Logger, cfg *Config, options ...grpc.ServerOption) (Server, error)

NewServer constructs a new server.

Jump to

Keyboard shortcuts

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