Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterGatewayHandler ¶
func RegisterGatewayHandler(name string, h GatewayHandler)
RegisterGatewayHandler registers a new http gateway handler for gRPC service
func RegisterService ¶
RegisterService registers a new gRPC service
func RegisterServiceWithGatewayHandler ¶
func RegisterServiceWithGatewayHandler(name string, s Service, h GatewayHandler)
RegisterServiceWithGatewayHandler registers a gRPC service with gateway handler
Types ¶
type Config ¶
type Config struct {
Enabled bool `mapstructure:"enabled"`
Address string `mapstructure:"address"`
Port int `mapstructure:"port"`
HTTP HTTPConfig `mapstructure:"http"`
}
Config defines the configurations of rpc server
type GRPCServer ¶
type GRPCServer interface {
GetChainReader() service.ChainReader
GetTxHandler() service.TxHandler
GetEventBus() eventbus.Bus
Stop()
}
GRPCServer interface breaks cycle import dependency
type GatewayHandler ¶
GatewayHandler defines the register func of http gateway handler for gRPC service
type HTTPConfig ¶
HTTPConfig defines the address/port of rest api over http
type Server ¶
type Server struct {
ChainReader service.ChainReader
TxHandler service.TxHandler
// contains filtered or unexported fields
}
Server defines the rpc server
func NewServer ¶
func NewServer(parent goprocess.Process, cfg *Config, cr service.ChainReader, txh service.TxHandler, bus eventbus.Bus) (*Server, error)
NewServer creates a RPC server instance.
func (*Server) GetChainReader ¶
func (s *Server) GetChainReader() service.ChainReader
GetChainReader returns an interface to observe chain state
func (*Server) GetEventBus ¶
GetEventBus returns a interface to publish events
func (*Server) GetTxHandler ¶
GetTxHandler returns a handler to deal with transactions