server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 11 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 service (a blocking call).
	Run() error
	// Quit terminates service gracefully.
	Quit()
	// GRPCServer returns underlying server implementation. Only for testing purposes.
	GRPCServer() *grpc.Server
	// MemLimiter returns internal MemLimiter object. Only for testing purposes.
	MemLimiter() memlimiter.Service
	// Tracker returns statistics tracker. Only for testing purposes.
	Tracker() *tracker.Tracker
}

Server represents Allocator service interface.

func NewServer added in v0.0.2

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

NewServer - server constructor.

Jump to

Keyboard shortcuts

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