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 ¶
- Variables
- func GetSupportedTransports() []string
- func IsValidBCTransport(transport string) bool
- func NewBCGRPCServer(protoAddr string, app types.ABCIApplicationServer, configs ...ServerConfig) (service.Service, error)
- func NewBCServer(address string, transport string, app types.Application, ...) (service.Service, error)
- type BCConnection
- type BCGRPCServer
- type BCServerOption
- type BCSocketOption
- type BCSocketServer
- type BCTransport
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
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") )
Functions ¶
func GetSupportedTransports ¶
func GetSupportedTransports() []string
GetSupportedTransports returns available transport protocols
func IsValidBCTransport ¶
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) 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