server

package
v0.0.0-...-2be76b0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package server provides Baron Chain's ABCI server implementations. Supported transport protocols:

  • gRPC: High-performance Protocol Buffers RPC server with quantum-safe cryptography
  • Socket: TCP socket-based server with AI-optimized routing

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerNotInit = errors.New("baron chain server not initialized")
	ErrServerRunning = errors.New("baron chain server already running")
	ErrInvalidAddr   = errors.New("invalid baron chain server address")
	ErrNilApp        = errors.New("baron chain application cannot be nil")
)
View Source
var (
	ErrInvalidTransport = errors.New("invalid baron chain transport protocol")
	ErrEmptyAddress     = errors.New("baron chain server address required")
	ErrNilApplication   = errors.New("baron chain application required")
)
View Source
var (
	ErrServerDown = errors.New("baron chain server not running")
	ErrBadConn    = errors.New("invalid baron chain connection")
	ErrClientDrop = errors.New("connection terminated by client")
)

Functions

func GetSupportedTransports

func GetSupportedTransports() []string

GetSupportedTransports returns available transport protocols

func IsValidBCTransport

func IsValidBCTransport(transport string) bool

IsValidBCTransport checks if transport protocol is supported

func NewBCGRPCServer

func NewBCGRPCServer(protoAddr string, app types.ABCIApplicationServer, configs ...ServerConfig) (service.Service, error)

NewBCGRPCServer creates a new Baron Chain gRPC server

func NewBCServer

func NewBCServer(address string, transport string, app types.Application, opts ...BCServerOption) (service.Service, error)

NewBCServer creates a new Baron Chain ABCI server

Parameters:

  • address: Server address (e.g., "tcp://0.0.0.0:26658")
  • transport: Transport protocol ("grpc" or "socket")
  • app: ABCI application implementation
  • opts: Optional server configurations

Returns:

  • service.Service: Server instance
  • error: Any initialization error

Types

type BCConnection

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

BCConnection represents a client connection to Baron Chain

type BCGRPCServer

type BCGRPCServer struct {
	service.BaseService
	// contains filtered or unexported fields
}

BCGRPCServer represents Baron Chain's gRPC ABCI server instance

func (*BCGRPCServer) GetServerAddr

func (s *BCGRPCServer) GetServerAddr() string

GetServerAddr returns the server's current address

func (*BCGRPCServer) OnStart

func (s *BCGRPCServer) OnStart() error

OnStart implements service.Service

func (*BCGRPCServer) OnStop

func (s *BCGRPCServer) OnStop()

OnStop implements service.Service

func (*BCGRPCServer) WaitForShutdown

func (s *BCGRPCServer) WaitForShutdown()

WaitForShutdown blocks until server stops

type BCServerOption

type BCServerOption func(*serverConfig)

BCServerOption configures Baron Chain server setup

func WithGRPCConfig

func WithGRPCConfig(opts ...GRPCOption) BCServerOption

WithGRPCConfig sets gRPC-specific server configuration

func WithSocketConfig

func WithSocketConfig(opts ...SocketOption) BCServerOption

WithSocketConfig sets socket-specific server configuration

type BCSocketOption

type BCSocketOption func(*BCSocketServer)

BCSocketOption configures the Baron Chain socket server

func WithConnectionTimeout

func WithConnectionTimeout(timeout time.Duration) BCSocketOption

func WithCustomBufferSize

func WithCustomBufferSize(size int) BCSocketOption

type BCSocketServer

type BCSocketServer struct {
	service.BaseService
	// contains filtered or unexported fields
}

BCSocketServer implements Baron Chain's socket-based ABCI server

func NewBCSocketServer

func NewBCSocketServer(protoAddr string, app types.Application, opts ...BCSocketOption) *BCSocketServer

NewBCSocketServer creates a new Baron Chain socket server

func (*BCSocketServer) OnStart

func (s *BCSocketServer) OnStart() error

func (*BCSocketServer) OnStop

func (s *BCSocketServer) OnStop()

type BCTransport

type BCTransport string

BCTransport represents Baron Chain server transport protocol

const (
	// Transport protocols
	TransportGRPC   BCTransport = "grpc"
	TransportSocket BCTransport = "socket"
)

type ServerConfig

type ServerConfig func(*BCGRPCServer)

func WithGracePeriod

func WithGracePeriod(period time.Duration) ServerConfig

Configure server shutdown grace period

func WithMaxMessageSize

func WithMaxMessageSize(recv, send int) ServerConfig

Configure server message size limits

Jump to

Keyboard shortcuts

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