rpc

package
v0.0.0-...-bda353b Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TLS_MODE_DISABLE = "disable"
	TLS_MODE_ONEWAY  = "oneway"
	TLS_MODE_TWOWAY  = "twoway"
)

TLS Mode

View Source
const (
	//SYSTEM_CHAIN the system chain name
	SYSTEM_CHAIN = "system_chain"
)
View Source
const (
	// TRUE true string
	TRUE = "true"
)
View Source
const (
	//UNKNOWN unknown string
	UNKNOWN = "unknown"
)

Variables

This section is empty.

Functions

func BlackListInterceptor

func BlackListInterceptor() grpc.UnaryServerInterceptor

BlackListInterceptor - set ip blacklist interceptor

func BlackListStreamInterceptor

func BlackListStreamInterceptor() grpc.StreamServerInterceptor

BlackListStreamInterceptor - set ip blacklist interceptor

func GetClientAddr

func GetClientAddr(ctx context.Context) string

func GrpcHandlerFunc

func GrpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler

func LoggingInterceptor

func LoggingInterceptor(ctx context.Context, req interface{},
	info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

LoggingInterceptor - set logging interceptor

func MonitorInterceptor

func MonitorInterceptor(ctx context.Context, req interface{},
	info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

MonitorInterceptor - set monitor interceptor

func RateLimitInterceptor

func RateLimitInterceptor() grpc.UnaryServerInterceptor

RateLimitInterceptor - set ratelimit interceptor

func RecoveryInterceptor

func RecoveryInterceptor(ctx context.Context, req interface{},
	_ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

RecoveryInterceptor - set recovery interceptor

func StreamRecoveryInterceptor

func StreamRecoveryInterceptor() grpc.StreamServerInterceptor

StreamRecoveryInterceptor - set stream recovery interceptor

Types

type ApiService

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

ApiService struct define

func NewApiService

func NewApiService(ctx context.Context, herbtServer *blockchain.HerbtServer) *ApiService

NewApiService - new ApiService object

func (*ApiService) CheckNewBlockChainConfig

CheckNewBlockChainConfig check new block chain config.

func (*ApiService) GetHerbtVersion

GetHerbtVersion get herbt version by rpc request

func (*ApiService) GetPoolStatus

func (s *ApiService) GetPoolStatus(ctx context.Context,
	request *txpoolPb.GetPoolStatusRequest) (*txpoolPb.TxPoolStatus, error)

GetPoolStatus Returns the max size of config transaction pool and common transaction pool, the num of config transaction in queue and pendingCache, and the the num of common transaction in queue and pendingCache.

func (*ApiService) GetTxIdsByTypeAndStage

GetTxIdsByTypeAndStage Returns config or common txIds in different stage. TxType may be TxType_CONFIG_TX, TxType_COMMON_TX, (TxType_CONFIG_TX|TxType_COMMON_TX) TxStage may be TxStage_IN_QUEUE, TxStage_IN_PENDING, (TxStage_IN_QUEUE|TxStage_IN_PENDING)

func (*ApiService) GetTxsInPoolByTxIds

GetTxsInPoolByTxIds Retrieve the transactions by the txIds from the txPool, return transactions in the txPool and txIds not in txPool. default query upper limit is 1w transaction, and error is returned if the limit is exceeded.

func (*ApiService) RefreshLogLevelsConfig

func (s *ApiService) RefreshLogLevelsConfig(ctx context.Context, req *configPb.LogLevelsRequest) (
	*configPb.LogLevelsResponse, error)

RefreshLogLevelsConfig - refresh log level

func (*ApiService) SendRequest

func (s *ApiService) SendRequest(ctx context.Context, req *commonPb.TxRequest) (*commonPb.TxResponse, error)

SendRequest - deal received TxRequest

func (*ApiService) Subscribe

func (s *ApiService) Subscribe(req *commonPb.TxRequest, server apiPb.RpcNode_SubscribeServer) error

Subscribe - deal block/tx/contracEvent subscribe request

func (*ApiService) SubscribeWS

func (s *ApiService) SubscribeWS(rawTxReq *commonPb.RawTxRequest, server apiPb.RpcNode_SubscribeWSServer) error

SubscribeWS processing requests for message subscription by websocket

func (*ApiService) UpdateDebugConfig

UpdateDebugConfig - update debug config for test

type RPCServer

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

RPCServer struct define

func NewRPCServer

func NewRPCServer(herbtServer *blockchain.HerbtServer) (*RPCServer, error)

NewRPCServer - new RPCServer object

func (*RPCServer) RegisterHandler

func (s *RPCServer) RegisterHandler() error

RegisterHandler - register apiservice handler to rpcserver

func (*RPCServer) Restart

func (s *RPCServer) Restart(reason string) error

Restart - Restart RPCServer

func (*RPCServer) Start

func (s *RPCServer) Start() error

Start - start RPCServer

func (*RPCServer) Stop

func (s *RPCServer) Stop()

Stop - stop RPCServer

Jump to

Keyboard shortcuts

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