Documentation
¶
Overview ¶
Package api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- func RegisterRpcNodeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterRpcNodeHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RpcNodeClient) error
- func RegisterRpcNodeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterRpcNodeHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RpcNodeServer) error
- func RegisterRpcNodeServer(s *grpc.Server, srv RpcNodeServer)
- type RpcNodeClient
- type RpcNodeServer
- type RpcNode_SubscribeClient
- type RpcNode_SubscribeServer
- type RpcNode_SubscribeWSClient
- type RpcNode_SubscribeWSServer
- type UnimplementedRpcNodeServer
- func (*UnimplementedRpcNodeServer) CheckNewBlockChainConfig(ctx context.Context, req *config.CheckNewBlockChainConfigRequest) (*config.CheckNewBlockChainConfigResponse, error)
- func (*UnimplementedRpcNodeServer) GetHerbtVersion(ctx context.Context, req *config.HerbtVersionRequest) (*config.HerbtVersionResponse, error)
- func (*UnimplementedRpcNodeServer) GetPoolStatus(ctx context.Context, req *txpool.GetPoolStatusRequest) (*txpool.TxPoolStatus, error)
- func (*UnimplementedRpcNodeServer) GetTxIdsByTypeAndStage(ctx context.Context, req *txpool.GetTxIdsByTypeAndStageRequest) (*txpool.GetTxIdsByTypeAndStageResponse, error)
- func (*UnimplementedRpcNodeServer) GetTxsInPoolByTxIds(ctx context.Context, req *txpool.GetTxsInPoolByTxIdsRequest) (*txpool.GetTxsInPoolByTxIdsResponse, error)
- func (*UnimplementedRpcNodeServer) RefreshLogLevelsConfig(ctx context.Context, req *config.LogLevelsRequest) (*config.LogLevelsResponse, error)
- func (*UnimplementedRpcNodeServer) SendRequest(ctx context.Context, req *common.TxRequest) (*common.TxResponse, error)
- func (*UnimplementedRpcNodeServer) Subscribe(req *common.TxRequest, srv RpcNode_SubscribeServer) error
- func (*UnimplementedRpcNodeServer) SubscribeWS(req *common.RawTxRequest, srv RpcNode_SubscribeWSServer) error
- func (*UnimplementedRpcNodeServer) UpdateDebugConfig(ctx context.Context, req *config.DebugConfigRequest) (*config.DebugConfigResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRpcNodeHandler ¶
func RegisterRpcNodeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterRpcNodeHandler registers the http handlers for service RpcNode to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterRpcNodeHandlerClient ¶
func RegisterRpcNodeHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RpcNodeClient) error
RegisterRpcNodeHandlerClient registers the http handlers for service RpcNode to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RpcNodeClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RpcNodeClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "RpcNodeClient" to call the correct interceptors.
func RegisterRpcNodeHandlerFromEndpoint ¶
func RegisterRpcNodeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterRpcNodeHandlerFromEndpoint is same as RegisterRpcNodeHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRpcNodeHandlerServer ¶
func RegisterRpcNodeHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RpcNodeServer) error
RegisterRpcNodeHandlerServer registers the http handlers for service RpcNode to "mux". UnaryRPC :call RpcNodeServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRpcNodeHandlerFromEndpoint instead.
func RegisterRpcNodeServer ¶
func RegisterRpcNodeServer(s *grpc.Server, srv RpcNodeServer)
Types ¶
type RpcNodeClient ¶
type RpcNodeClient interface {
// processing transaction message requests
SendRequest(ctx context.Context, in *common.TxRequest, opts ...grpc.CallOption) (*common.TxResponse, error)
// processing requests for message subscription
Subscribe(ctx context.Context, in *common.TxRequest, opts ...grpc.CallOption) (RpcNode_SubscribeClient, error)
// processing requests for message subscription by websocket
SubscribeWS(ctx context.Context, in *common.RawTxRequest, opts ...grpc.CallOption) (RpcNode_SubscribeWSClient, error)
// update debug status (development debugging)
UpdateDebugConfig(ctx context.Context, in *config.DebugConfigRequest, opts ...grpc.CallOption) (*config.DebugConfigResponse, error)
// refreshLogLevelsConfig
RefreshLogLevelsConfig(ctx context.Context, in *config.LogLevelsRequest, opts ...grpc.CallOption) (*config.LogLevelsResponse, error)
// get Herbt version
GetHerbtVersion(ctx context.Context, in *config.HerbtVersionRequest, opts ...grpc.CallOption) (*config.HerbtVersionResponse, error)
// check chain configuration and load new chain dynamically
CheckNewBlockChainConfig(ctx context.Context, in *config.CheckNewBlockChainConfigRequest, opts ...grpc.CallOption) (*config.CheckNewBlockChainConfigResponse, 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.
GetPoolStatus(ctx context.Context, in *txpool.GetPoolStatusRequest, opts ...grpc.CallOption) (*txpool.TxPoolStatus, error)
// 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)
GetTxIdsByTypeAndStage(ctx context.Context, in *txpool.GetTxIdsByTypeAndStageRequest, opts ...grpc.CallOption) (*txpool.GetTxIdsByTypeAndStageResponse, error)
// 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.
GetTxsInPoolByTxIds(ctx context.Context, in *txpool.GetTxsInPoolByTxIdsRequest, opts ...grpc.CallOption) (*txpool.GetTxsInPoolByTxIdsResponse, error)
}
RpcNodeClient is the client API for RpcNode service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewRpcNodeClient ¶
func NewRpcNodeClient(cc *grpc.ClientConn) RpcNodeClient
type RpcNodeServer ¶
type RpcNodeServer interface {
// processing transaction message requests
SendRequest(context.Context, *common.TxRequest) (*common.TxResponse, error)
// processing requests for message subscription
Subscribe(*common.TxRequest, RpcNode_SubscribeServer) error
// processing requests for message subscription by websocket
SubscribeWS(*common.RawTxRequest, RpcNode_SubscribeWSServer) error
// update debug status (development debugging)
UpdateDebugConfig(context.Context, *config.DebugConfigRequest) (*config.DebugConfigResponse, error)
// refreshLogLevelsConfig
RefreshLogLevelsConfig(context.Context, *config.LogLevelsRequest) (*config.LogLevelsResponse, error)
// get Herbt version
GetHerbtVersion(context.Context, *config.HerbtVersionRequest) (*config.HerbtVersionResponse, error)
// check chain configuration and load new chain dynamically
CheckNewBlockChainConfig(context.Context, *config.CheckNewBlockChainConfigRequest) (*config.CheckNewBlockChainConfigResponse, 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.
GetPoolStatus(context.Context, *txpool.GetPoolStatusRequest) (*txpool.TxPoolStatus, error)
// 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)
GetTxIdsByTypeAndStage(context.Context, *txpool.GetTxIdsByTypeAndStageRequest) (*txpool.GetTxIdsByTypeAndStageResponse, error)
// 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.
GetTxsInPoolByTxIds(context.Context, *txpool.GetTxsInPoolByTxIdsRequest) (*txpool.GetTxsInPoolByTxIdsResponse, error)
}
RpcNodeServer is the server API for RpcNode service.
type RpcNode_SubscribeClient ¶
type RpcNode_SubscribeClient interface {
Recv() (*common.SubscribeResult, error)
grpc.ClientStream
}
type RpcNode_SubscribeServer ¶
type RpcNode_SubscribeServer interface {
Send(*common.SubscribeResult) error
grpc.ServerStream
}
type RpcNode_SubscribeWSClient ¶
type RpcNode_SubscribeWSClient interface {
Recv() (*common.SubscribeResult, error)
grpc.ClientStream
}
type RpcNode_SubscribeWSServer ¶
type RpcNode_SubscribeWSServer interface {
Send(*common.SubscribeResult) error
grpc.ServerStream
}
type UnimplementedRpcNodeServer ¶
type UnimplementedRpcNodeServer struct {
}
UnimplementedRpcNodeServer can be embedded to have forward compatible implementations.
func (*UnimplementedRpcNodeServer) CheckNewBlockChainConfig ¶
func (*UnimplementedRpcNodeServer) CheckNewBlockChainConfig(ctx context.Context, req *config.CheckNewBlockChainConfigRequest) (*config.CheckNewBlockChainConfigResponse, error)
func (*UnimplementedRpcNodeServer) GetHerbtVersion ¶
func (*UnimplementedRpcNodeServer) GetHerbtVersion(ctx context.Context, req *config.HerbtVersionRequest) (*config.HerbtVersionResponse, error)
func (*UnimplementedRpcNodeServer) GetPoolStatus ¶
func (*UnimplementedRpcNodeServer) GetPoolStatus(ctx context.Context, req *txpool.GetPoolStatusRequest) (*txpool.TxPoolStatus, error)
func (*UnimplementedRpcNodeServer) GetTxIdsByTypeAndStage ¶
func (*UnimplementedRpcNodeServer) GetTxIdsByTypeAndStage(ctx context.Context, req *txpool.GetTxIdsByTypeAndStageRequest) (*txpool.GetTxIdsByTypeAndStageResponse, error)
func (*UnimplementedRpcNodeServer) GetTxsInPoolByTxIds ¶
func (*UnimplementedRpcNodeServer) GetTxsInPoolByTxIds(ctx context.Context, req *txpool.GetTxsInPoolByTxIdsRequest) (*txpool.GetTxsInPoolByTxIdsResponse, error)
func (*UnimplementedRpcNodeServer) RefreshLogLevelsConfig ¶
func (*UnimplementedRpcNodeServer) RefreshLogLevelsConfig(ctx context.Context, req *config.LogLevelsRequest) (*config.LogLevelsResponse, error)
func (*UnimplementedRpcNodeServer) SendRequest ¶
func (*UnimplementedRpcNodeServer) SendRequest(ctx context.Context, req *common.TxRequest) (*common.TxResponse, error)
func (*UnimplementedRpcNodeServer) Subscribe ¶
func (*UnimplementedRpcNodeServer) Subscribe(req *common.TxRequest, srv RpcNode_SubscribeServer) error
func (*UnimplementedRpcNodeServer) SubscribeWS ¶
func (*UnimplementedRpcNodeServer) SubscribeWS(req *common.RawTxRequest, srv RpcNode_SubscribeWSServer) error
func (*UnimplementedRpcNodeServer) UpdateDebugConfig ¶
func (*UnimplementedRpcNodeServer) UpdateDebugConfig(ctx context.Context, req *config.DebugConfigRequest) (*config.DebugConfigResponse, error)