server

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: BSD-3-Clause Imports: 35 Imported by: 0

Documentation

Overview

Package server implements server.

Index

Constants

View Source
const (
	// RPCVersion should be bumped anytime changes are made which require
	// the RPC client to upgrade to latest RPC server to be compatible
	RPCVersion   uint32 = 1
	MinNodes     uint32 = 1
	DefaultNodes uint32 = 5

	TimeParseLayout        = "2006-01-02 15:04:05"
	StakingMinimumLeadTime = 25 * time.Second
)

Variables

View Source
var (
	ErrInvalidVMName          = errors.New("invalid VM name")
	ErrInvalidPort            = errors.New("invalid port")
	ErrNotEnoughNodesForStart = errors.New("not enough nodes specified for start")
	ErrAlreadyBootstrapped    = errors.New("already bootstrapped")
	ErrNotBootstrapped        = errors.New("not bootstrapped")
	ErrNodeNotFound           = errors.New("node not found")
	ErrPeerNotFound           = errors.New("peer not found")
	ErrStatusCanceled         = errors.New("gRPC stream status canceled")
	ErrNoBlockchainSpec       = errors.New("no blockchain spec was provided")
	ErrNoSubnetID             = errors.New("subnetID is missing")
	ErrNoElasticSubnetSpec    = errors.New("no elastic subnet spec was provided")
	ErrNoValidatorSpec        = errors.New("no validator spec was provided")
)

Functions

func IsServerError

func IsServerError(err error, serverError error) bool

grpc encapsulates the non protocol-related, ANR server domain errors, inside grpc.status.Status structs, with status.Code() code.Unknown, and original error msg inside status.Message() string this aux function is to be used by clients, to check for the appropriate ANR domain error kind

Types

type Config

type Config struct {
	Port   string
	GwPort string
	// true to disable grpc-gateway server
	GwDisabled          bool
	DialTimeout         time.Duration
	RedirectNodesOutput bool
	SnapshotsDir        string
	LogLevel            logging.Level
}

type Server

type Server interface {
	Run(rootCtx context.Context) error
}

func New

func New(cfg Config, log logging.Logger) (Server, error)

Jump to

Keyboard shortcuts

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