server

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c Config, opts ...Option) (*gNMIServer, error)

func WithCapabilitiesHandler

func WithCapabilitiesHandler(h CapabilitiesHandler) func(*gNMIServer)

func WithGetHandler

func WithGetHandler(h GetHandler) func(*gNMIServer)

func WithLogger

func WithLogger(l *log.Logger) func(*gNMIServer)

opts

func WithRegistry

func WithRegistry(reg *prometheus.Registry) func(*gNMIServer)

func WithSetHandler

func WithSetHandler(h SetHandler) func(*gNMIServer)

func WithSubscribeHandler

func WithSubscribeHandler(h SubscribeHandler) func(*gNMIServer)

Types

type CapabilitiesHandler

type CapabilitiesHandler func(ctx context.Context, req *gnmi.CapabilityRequest) (*gnmi.CapabilityResponse, error)

gNMI Handlers

type Config

type Config struct {
	// gRPC server address
	Address string
	// MaxUnaryRPC defines the max number of inflight
	// Unary RPCs (Cap, Get, Set,...).
	// if negative or unset, there is not limit.
	MaxUnaryRPC int64
	// MaxStreamingRPC defines the max number of inflight
	// streaming RPCs (Subscribe,...).
	// if negative or unset, there is not limit.
	MaxStreamingRPC int64
	// MaxRecvMsgSize defines the max message
	// size in bytes the server can receive.
	// If this is not set, it defaults to 4MB.
	MaxRecvMsgSize int
	// MaxSendMsgSize defines the the max message
	// size in bytes the server can send.
	// If this is not set, the default is `math.MaxInt32`.
	MaxSendMsgSize int
	// MaxConcurrentStreams defines the max number of
	// concurrent streams to each ServerTransport.
	MaxConcurrentStreams uint32
	// TCPKeepalive set the TCP keepalive time and
	// interval, if unset it is enabled based on
	// the protocol used and the OS.
	// If negative it is disabled.
	TCPKeepalive time.Duration
	// Keepalive params
	Keepalive *keepalive.ServerParameters
	// enable gRPC Health RPCs
	HealthEnabled bool
	// unary RPC request timeout
	Timeout time.Duration
	// RPCs rate limit
	RateLimit int64
	// TLS config
	TLS *types.TLSConfig
}

type GetHandler

type GetHandler func(ctx context.Context, req *gnmi.GetRequest) (*gnmi.GetResponse, error)

type Option

type Option func(*gNMIServer)

type SetHandler

type SetHandler func(ctx context.Context, req *gnmi.SetRequest) (*gnmi.SetResponse, error)

type SubscribeHandler

type SubscribeHandler func(req *gnmi.SubscribeRequest, stream gnmi.GNMI_SubscribeServer) error

Jump to

Keyboard shortcuts

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