api

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

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 transaction message requests in sync mode.
	// returns tx execution result
	SendRequestSync(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 chainmaker version
	GetChainMakerVersion(ctx context.Context, in *config.ChainMakerVersionRequest, opts ...grpc.CallOption) (*config.ChainMakerVersionResponse, 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)
	// GetTxStatus Get the transaction status by txId.
	// return TxStatus.
	GetTxStatus(ctx context.Context, in *txpool.GetTxStatusRequest, opts ...grpc.CallOption) (*txpool.GetTxStatusResponse, error)
	// GetConsensusStateJSON query the state of the consensus,
	// return the consensus status after JSON serialization, including consensus nodes, heights, and views.
	GetConsensusStateJSON(ctx context.Context, in *consensus.GetConsensusStatusRequest, opts ...grpc.CallOption) (*wrapperspb.BytesValue, error)
	// GetConsensusValidators Gets the consensus node list
	GetConsensusValidators(ctx context.Context, in *consensus.GetConsensusStatusRequest, opts ...grpc.CallOption) (*consensus.Validators, error)
	// GetConsensusHeight Gets the height of the block that the node is currently agreeing on
	GetConsensusHeight(ctx context.Context, in *consensus.GetConsensusStatusRequest, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, 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 transaction message requests in sync mode.
	// returns tx execution result
	SendRequestSync(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 chainmaker version
	GetChainMakerVersion(context.Context, *config.ChainMakerVersionRequest) (*config.ChainMakerVersionResponse, 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)
	// GetTxStatus Get the transaction status by txId.
	// return TxStatus.
	GetTxStatus(context.Context, *txpool.GetTxStatusRequest) (*txpool.GetTxStatusResponse, error)
	// GetConsensusStateJSON query the state of the consensus,
	// return the consensus status after JSON serialization, including consensus nodes, heights, and views.
	GetConsensusStateJSON(context.Context, *consensus.GetConsensusStatusRequest) (*wrapperspb.BytesValue, error)
	// GetConsensusValidators Gets the consensus node list
	GetConsensusValidators(context.Context, *consensus.GetConsensusStatusRequest) (*consensus.Validators, error)
	// GetConsensusHeight Gets the height of the block that the node is currently agreeing on
	GetConsensusHeight(context.Context, *consensus.GetConsensusStatusRequest) (*wrapperspb.UInt64Value, 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) GetChainMakerVersion

func (*UnimplementedRpcNodeServer) GetConsensusHeight

func (*UnimplementedRpcNodeServer) GetConsensusStateJSON

func (*UnimplementedRpcNodeServer) GetConsensusValidators

func (*UnimplementedRpcNodeServer) GetPoolStatus

func (*UnimplementedRpcNodeServer) GetTxIdsByTypeAndStage

func (*UnimplementedRpcNodeServer) GetTxStatus

func (*UnimplementedRpcNodeServer) GetTxsInPoolByTxIds

func (*UnimplementedRpcNodeServer) RefreshLogLevelsConfig

func (*UnimplementedRpcNodeServer) SendRequest

func (*UnimplementedRpcNodeServer) SendRequestSync added in v3.0.1

func (*UnimplementedRpcNodeServer) Subscribe

func (*UnimplementedRpcNodeServer) SubscribeWS

func (*UnimplementedRpcNodeServer) UpdateDebugConfig

Jump to

Keyboard shortcuts

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