rpc

package
v0.4.7-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package rpc provides the rpc server which is responsible for handling requests from the client.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRPCPort occurs when the port in the config is invalid.
	ErrInvalidRPCPort = errors.New("invalid port number for RPC server")
	// ErrInvalidCertFile occurs when the certificate file is invalid.
	ErrInvalidCertFile = errors.New("invalid cert file for RPC server")
	// ErrInvalidKeyFile occurs when the key file is invalid.
	ErrInvalidKeyFile = errors.New("invalid key file for RPC server")
	// ErrInvalidMaxConnectionAge occurs when the max connection age is invalid.
	ErrInvalidMaxConnectionAge = errors.New("invalid max connection age for RPC server")
	// ErrInvalidMaxConnectionAgeGrace occurs when the max connection age grace is invalid.
	ErrInvalidMaxConnectionAgeGrace = errors.New("invalid max connection age grace for RPC server")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Port is the port number for the RPC server.
	Port int `yaml:"Port"`

	// CertFile is the path to the certificate file.
	CertFile string `yaml:"CertFile"`

	// KeyFile is the path to the key file.
	KeyFile string `yaml:"KeyFile"`

	// MaxRequestBytes is the maximum client request size in bytes the server will accept.
	MaxRequestBytes uint64 `yaml:"MaxRequestBytes"`

	// MaxConnectionAge is a duration for the maximum amount of time a connection may exist
	// before it will be closed by sending a GoAway.
	MaxConnectionAge string `yaml:"MaxConnectionAge"`

	// MaxConnectionAgeGrace is a duration for the amount of time after receiving a GoAway
	// for pending RPCs to complete before forcibly closing connections.
	MaxConnectionAgeGrace string `yaml:"MaxConnectionAgeGrace"`
}

Config is the configuration for creating a Server instance.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the port number and the files for certification.

type Server

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

Server is a normal server that processes the logic requested by the client.

func NewServer

func NewServer(conf *Config, be *backend.Backend) (*Server, error)

NewServer creates a new instance of Server.

func (*Server) Shutdown

func (s *Server) Shutdown(graceful bool)

Shutdown shuts down this server.

func (*Server) Start

func (s *Server) Start() error

Start starts this server by opening the rpc port.

Directories

Path Synopsis
Package auth provides authentication and authorization for RPCs.
Package auth provides authentication and authorization for RPCs.
Package grpchelper provides helper functions for gRPC.
Package grpchelper provides helper functions for gRPC.
Package interceptors provides the interceptors for RPC.
Package interceptors provides the interceptors for RPC.
Package metadata provides metadata for RPC.
Package metadata provides metadata for RPC.

Jump to

Keyboard shortcuts

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